Home All Groups Group Topic Archive Search About

Dynamically import fusion.dll

Author
16 Dec 2005 1:02 PM
Will Holley
I'd like to dynamically import methods from the fusion library (fusion.dll).
However, if I just do a straight [DllImport(blah)], I can't guarantee that I
get the .Net 2 runtime version.

I've found that the unmanaged method LoadLibraryShim in mscoree.dll will
return a module handle to the latest runtime version, the thing I can't
figure out is how to then use this handle to invoke methods on the library
from C#.

Any hints gratefully received!

Author
16 Dec 2005 8:16 PM
Mattias Sjögren
Will,

>I'd like to dynamically import methods from the fusion library (fusion.dll).
>However, if I just do a straight [DllImport(blah)], I can't guarantee that I
>get the .Net 2 runtime version.

Since fusion.dll is used by the CLR itself you should get the "right"
version corresponding to the CLR version you've loaded if you simply
use DllImport("fusion.dll"). That is, if you make sure your app runs
under the v2.0 CLR you should get the desired DLL version. Isn't that
what you want?


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

AddThis Social Bookmark Button