rossb83
rossb83

Reputation: 1762

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?

Upvotes: 4

Views: 3743

Answers (2)

Mark B
Mark B

Reputation: 96291

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.

Upvotes: 5

Aaron Klotz
Aaron Klotz

Reputation: 11585

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.

Upvotes: 7

Related Questions