Loading a shared library on Windows

I built a shared library, according to the MSVC property manager it is a 32-bit DLL. Yet, when I do

julia> lib = Libdl.dlopen("C:\\Users\\PetrKrysl\\Documents\\Work-in-progress\\H2Lib-community\\build\\Library\\Release\\H2LIB.dll")

I get

ERROR: could not load library "C:\Users\PetrKrysl\Documents\Work-in-progress\H2Lib-community\build\Library\Release\H2LIB.dll"
%1 is not a valid Win32 application.

How do I begin to figure out what is wrong with that DLL?

1 Like

There was a similar thread recently where 32 vs 64 bit windows/Julia was an issue that may be a starting point. Can you give any more info on your build process?

1 Like

My student, who solved the problem, will write a tutorial to the others students showing how he did it. As soon as he finishes, I will post the steps here!

So, is the issue that a 64-bit Julia cannot load a 32-bit shared library?

Yes.

Thanks! Is that a general statement for any operating system? Clearly I can run 32-bit Julia on a 64-bit Windows 10… So isn’t that exe loading some Windows libs?

Yes, those in WOW (Windows On Windows), which is the Windows64 subsystem for 32 bits.

Got it. Thanks.