C#: Access 32-bit/64-bit DLL depending on platform
Posted
by Thorsten Dittmar
on Stack Overflow
See other posts from Stack Overflow
or by Thorsten Dittmar
Published on 2010-03-04T10:33:37Z
Indexed on
2010/04/13
19:53 UTC
Read the original article
Hit count: 339
Hi,
we use a self-written 32bit C++ DLL from our C# applications. Now we've noticed that when the C# applications are run on a 64bit system, the 64bit runtime is automatically used and of course the 32bit DLL can not be accessed from the 64bit runtime.
My question is: is there a way of using the 32bit DLL? If not, if I created a 64bit version of the DLL, would it be easily possible to let the application choose which one to P/Invoke to?
I'm thinking of creating two helper classes in C#: One that imports the functions from the 32bit DLL and one that imports from the 64bit DLL, then creating a wrapper class with one function for each imported function that calls either the 32bit importer or the 64bit importer depending on the "bittyness" of the OS. Would that work?
Or is there another easy way to do things?
© Stack Overflow or respective owner