Platform Invoke, LoaderLock

  • Thread starter Thread starter Light
  • Start date Start date
L

Light

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
 
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.
 
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.
 
| 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.
 
Back
Top