471,325 Members | 1,591 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 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 3729
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by John Altland | last post: by
1 post views Thread by Mircea Pleteriu | last post: by
reply views Thread by jnospamster | last post: by
3 posts views Thread by Ron | last post: by
11 posts views Thread by Beorne | last post: by
3 posts views Thread by aaron.m.johnson | last post: by

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.