473,395 Members | 1,462 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Platform Invoke, LoaderLock

I've a few questions on platform invoke and some issues I've seen.

1. Is it possible to avoid LoaderLock exception without simply turning
it off? Does it occur in .NET projects with win32 dll or ONLY in .NET
projects with a mixed win32+.NET dll?

2. How to pass a .NET type to a C++ char ** type? My assumption is
this is required unsafe code section and use of pointer.
Curtis
http://www.ghostclip.com
The Premier Help System For Developers

Feb 5 '06 #1
3 3785
Light,
1. Is it possible to avoid LoaderLock exception without simply turning
it off? Does it occur in .NET projects with win32 dll or ONLY in .NET
projects with a mixed win32+.NET dll?
LoaderLockException? I can't find any documentation in the framework
that this even exists. Are you sure it is this, and not something else?
2. How to pass a .NET type to a C++ char ** type? My assumption is
this is required unsafe code section and use of pointer.


You can do it with an IntPtr as well. You don't ^need^ unsafe code, but
it would probably make it much easier.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
Feb 5 '06 #2
> LoaderLockException? I can't find any documentation in the framework
that this even exists. Are you sure it is this, and not something else?
It's part of the Visual Studio.Net 2005 debugging apparatus. You can find it
under the Debug|Exceptions menu. Look at "Managed Debugging Assistants."

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eH*************@tk2msftngp13.phx.gbl... Light,
1. Is it possible to avoid LoaderLock exception without simply turning
it off? Does it occur in .NET projects with win32 dll or ONLY in .NET
projects with a mixed win32+.NET dll?


LoaderLockException? I can't find any documentation in the framework
that this even exists. Are you sure it is this, and not something else?
2. How to pass a .NET type to a C++ char ** type? My assumption is
this is required unsafe code section and use of pointer.


You can do it with an IntPtr as well. You don't ^need^ unsafe code,
but it would probably make it much easier.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

Feb 5 '06 #3

"Light" <Li********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
| I've a few questions on platform invoke and some issues I've seen.
|
| 1. Is it possible to avoid LoaderLock exception without simply turning
| it off? Does it occur in .NET projects with win32 dll or ONLY in .NET
| projects with a mixed win32+.NET dll?
|
A Loaderlocks MDA (which is not an exception), occurs when a Win32 or a
mixed mode DLL calls into managed code when it holds a NT loader lock
(mostly when executing in DllMain), so the only way to get rid of this is by
correcting the DLL code.

| 2. How to pass a .NET type to a C++ char ** type? My assumption is
| this is required unsafe code section and use of pointer.

In general unsafe is not needed, an IntPtr can be used as well.

Willy.

Feb 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Altland | last post by:
Here is my basic problem. I have a form that executes a cpu instensive algorithm occupying the first thread. When the algorithm is executed another form pops up telling the user the progress that...
1
by: Mircea Pleteriu | last post by:
Hi all, I need to call an Win32 API function within the c# code. The function is InternetOpen. One of the arguments of the function is of type DWORD, so it can be tranlated to sn Int32 but...
2
by: Tom | last post by:
Hi Everybod I want to update some controls in a form from another threads. I did it by passing the form to that thread and calling a delegate with Form1.Invoke, I want to have just one delegeate...
0
by: sqcliu | last post by:
I encounter a strange problem using platform invoke using C#. The senario is this: I have a dll which uses a 3rd party static link library (lib). Inside the lib, there are some C structures...
0
by: Steve Terepin | last post by:
I have a Solution that consists of two projects, one written in C/C++ that builds a DLL, and another written in C# that builds an EXE. I'm using P/Invoke to call the DLL, and it all works just...
0
by: jnospamster | last post by:
I am getting a LoaderLock message in an application I have written for ..Net 2.0 in C#. It contains only pure managed assemblies. The application consists of 1 dll and 2 .exe projects which...
3
by: Ron | last post by:
I have two forms. When I click on new entry I hide current form and show form2 as soon as I click on a textbox in form2 I get a loaderlock error. What is this? How can I get rid of this?
11
by: Beorne | last post by:
I'm trying to call a third party dll routine from C# using pinvoke. Unfortunately I obtain a LoaderLock exception and my application stops. I've seen that it must be some uncorrect behaviour of...
3
by: aaron.m.johnson | last post by:
Help me understand this, please. I have an older VC++ COM DLL that I'm using in a C# project. One of the COM objects takes a callback object as a parameter so that it can spin off a thread and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.