Using a 64-bit DLL in a 32-bit application

Xcode ARC refactoring caused my Cocoa library DLL to be 64-bit, and I don't know if DllImport can still DllImport this DLL from the x86 C # application. Is this possible, and are there any consequences?

+4
source share
3 answers

You cannot mix 32-bit and 64-bit code in one process. Thus, the only way to use the mix bit code is to have more than one process. You will need some form of IPC to make it work. You cannot do this with DllImport , as it is in the process.

+6
source

The problem is not really C # - it is a hosting process in the OS. Since one process can only load DLL files with the same "bit", either the process is 64 bits, or you cannot directly load your DLL. No matter what language or framework you use.

One solution would be to aim the C # project to use "any" processor, or specifically point it to X64.

Another solution would be to create a hosting process with which you can communicate using IPC or similar models.

0
source

The solution if necessary is to call the EXE in the pipeline or similar. This assumes, of course, 64-bit windows. If not, punt.

0
source

Source: https://habr.com/ru/post/1469077/


All Articles