To get the compiler / framework to do most of the work you need,
- have several build platforms (usually x86, x64 - remove AnyCPU)
- configure each platform configuration for each assembly configuration.
- we added __WIN32 and __X64 compilation conditionals
List the various implementations of your functions according to the platform, including different dll names if you need to install both installed at the same time.
#if __WIN32 public delegate int Move(int target); [DllImport("my.dll", SetLastError = true, CharSet = CharSet.Auto)] #elif __X64 public delegate int Move(int target); [DllImport("my64.dll", SetLastError = true, CharSet = CharSet.Auto)] #endif
Otherwise, you can use loadlib and manage the sort yourself.
Greg domjan
source share