Compile for a mixed platform (32, 64) and reference the 32 or 64-bit DLL allowed at runtime

Using VS2010 under 32 or 64 bit windows. Our C # application calls a third-party DLL (managed) that interacts with the unmanaged DLL. The third-party DLL-API looks identical in 32 or 64 bits, although under it there are links to a 32 or 64-bit unmanaged DLL.

We want our C # application to run on a 32-bit or 64-bit OS, ideally it automatically detects the OS and loads the corresponding 32-bit DLL group - through a simple factory class that checks Enviroment. Thus, the most convenient solution would be a runtime folder containing: OurApp.exe 3rdParty32.DLL 3rdPartyUnmanaged32.DLL 3rdParty64.DLL 3rdPartyUnmanaged64.DLL

However, the interface for managed dlls 3Party 32 and 64 is identical, so both of them cannot be specified within the same VS2010 project: when you add the second, a warning triangle is displayed and is not referenced.

Is my only answer to the creation of two additional libraries of DLL projects for referencing 3Party 32 and 64 Dll? Thus, I would finish this project: Project 1: Creates OurApp.exe, dynamically creates an object for project2 or project3. Project 2: Creates OurApp32.DLL, which references 3rdParty32.dll Project 3: Creates OurApp32.DLL, which references 3rdParty64.dll

+5
source share
4 answers

, 32- 64- , , JIT . make , 64- 32-, csproj 32- 64- DLL. , , .

+5

, , , .

?

0

, :

YourApp32.exe YourApp64.exe, . YourApp.exe, YourApp32.exe, YourApp64.exe.

, , , , , .

0

- factory . , , . , ( , ). , .

, DLL , , .

This is a very hacky way to do this. If you have this option, ask third-party DLL providers and see if you can convince them to expose either the abstract classes or the interfaces corresponding to their two DLLs to the third assembly, then you can reference this without any confusion with delegates.

0
source

All Articles