Hello all, I’m seeking advice for importing an x86 C++ library into UE. I’ve got it importing as a Third Party Library Plugin but it won’t build with the error of library machine type 'x86' conflicts with target machine type 'x64'
Should I attempt to convert this medium sized library to x64 or is there another way to utilize it in UE? Thank you in advance. ^^
Unfortunately, this is a limitation of Windows as a whole (and, really, pretty much every other operating system as well): a 64-bit process cannot load a 32-bit library. So if you want to load it in Unreal, you’re going to pretty much have to port it to 64-bit.
Any methods to load a 32-bit library in a 64-bit process – and I have seen some really clever workaround hacks – will be a real pain to implement.
As an example, I’ve seen a legacy library loaded on Linux by having a 32-bit application load the 32-bit library, then export all the library functions via DBus and create a 64-bit shim layer that implements the legacy library’s API, but simply calls the functions in the other process. So basically you have a 64-bit process that thinks it has the library, but the function calls actually all go to an entirely different separate program running in the background, which is 32-bit and thus can load the 32-bit library.
Clever? Yes. Overcomplicated? Also yes. (Though in that particular case it was a library from a company that was no longer around, which only existed in binary format and which no one had source code to, so it admittedly wasn’t like there were many other options.)
But needless to say, coming up with a Windows version of that sort of workaround and grafting it into Unreal would be Kind of a Lot of Work… potentially far more than just getting a 64-bit version of the library compiled would be.
Wow, thank you for the very broken down response here. Those surely are some clever workarounds and it does sound still like my best bet will be trying to convert the c++ to x64.
To add fullness to this post, I am currently attempting to integrate the Zoom Meetings SDK into UE for displaying video streams and the zoom ui in game. Which they’ve only provided an x86 library for. I have found a few articles on porting c++ projects from x86 to x64 so hopefully I’ll follow those and end up with an x64 Zoom Meetings SDK then.
Well thank you again for the very elaborate discussion on the idea, I believe you’ve really helped me visualize my options moving forward with this.
Actually, I might have some good news for you in that case: I believe the most recent Zoom SDK does contain 64-bit versions!
(And though I’m not at a computer where I have a copy of the SDK to check and confirm, a very quick skimming of the Zoom developer forums did turn up a recent post by a Zoom staffer mentioning that the SDK now has 64-bit versions of the libraries… though, to be fair, I’m not sure if that’s in the release versions of the SDK or the “have fun, hope it doesn’t break” bleeding-edge beta versions.)
This is, however, a very recent development, so depending on how long ago you downloaded the SDK, it’s quite possible the version you have is just old enough to not have had the 64-bit libraries yet.
Oh my goodness! Thank you so much somehow the version I have was outdated despite obtaining it just days ago; Downloading the latest sdk does in fact seem to have an x64 folder!
I was so close to taking an alternative, thank you so much!