Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling 32 bit lib files from 64 bit targeted application

I am writing a 64 bit targeted c++ program. I need to call commands from a 3rd party .lib file that is targeted towards a 32 bit environment, however when trying to do so I get a LNK2001 error. Is it possible to do this?

like image 500
rossb83 Avatar asked Dec 17 '22 16:12

rossb83


2 Answers

Not directly, no; you can't link 32-bit code into a 64-bit executable.

Perhaps you could create a separate 32-bit process to host your static lib and write a stub API in your 64-bit program that uses interprocess communication to have the 32-bit process execute the code on your behalf.

like image 170
Aaron Klotz Avatar answered Dec 19 '22 07:12

Aaron Klotz


You can't do this directly within an application.

Your best option is to get a 64-bit version of the library.

If you can't do that, you can create a separate 32-bit app that acts as a mediator between your main program and the library, using sockets or pipes to communicate.

like image 26
Mark B Avatar answered Dec 19 '22 05:12

Mark B