I am using an unmanaged library in a .net application which is used on x86 and 64bit systems alike and therefore is compiled as ‘Any CPU’. The unmanaged, native .dll however comes in two different .dlls for that (one for win32 and one for x64).
Is there any way to still keep the ‘Any CPU’ / one binary way with different native .dlls regarding the P/Invoke signatures for x86 & 64bit systems? Or -is- the only way to create separate configs & therefore distributions? If so, are there any compile #if/#endif flags I can use for that?
I would put the p/invoke code into a seperate assemblies (one for 32 and one for 64 bits) and then load the appropriate one at run time depending upon the platform.
There are many ways to determine the type of the system. Lots are documented here.