Linking to an external library

chrisdawlud
Enthusiast
Enthusiast

Linking to an external library

chrisdawlud
Enthusiast
Enthusiast

I'm writing a global utility plugin and I want to use OpenImageIO library. The obvious solution is to create the plugin executable, statically linking against the static OIIO library, which ends up with one executable, but I'm having a hard time making this approach work, because of the library-specific errors that I'm getting.

Until I solve this, I want to dynamically link to OIIO library at load-time, but I don't know how to do that properly.

 

The OIIO library requires 14 dependencies (e.g. boost_filesysten-vc142-mt-x64-1_70.dll, IlmImf-2_3.dll, jpeg62.dll, etc.)

I'm using vcpkg, so all these .dlls are automatically copied to where the plugin .dll is in 3ds Max 2020/Plugins, but I'm still getting the following error when the plugin is loaded.

 problem.jpg

0 Likes
Reply
875 Views
8 Replies
Replies (8)

istan
Advisor
Advisor

Put these DLLs to the path where 3dsmax.exe is located.

0 Likes

chrisdawlud
Enthusiast
Enthusiast

That would override already existing libraries like zlib.dll or jpeg62.dll. I tried it anyway, but I got the same error dialog as before, and additional one with 'stdplugins/OSLMap.dlt failed to initialize'  instead.

0 Likes

istan
Advisor
Advisor

I would check with 'depency walker' which other DLLs might be missing..

0 Likes

chrisdawlud
Enthusiast
Enthusiast

It doesn't really tell me what is going on exactly, but I don't think it's because the dependencies are missing, but rather they are not loaded properly. Is there some alternative to moving the .dlls inside root 3ds Max folder?

 

dependencies.jpg

0 Likes

istan
Advisor
Advisor

The last two yellow marked DLLs are missing. Search for them on the disk, your GUP needs them aparently.

0 Likes

chrisdawlud
Enthusiast
Enthusiast

These 2 dependencies seem to be resolved at a later stage because they always show up as not found even if some plugin requiring them is loaded correctly. Same thing with BMM.DLL, CORE.DLL, GUP.DLL, etc. if the scanned .dll is not in root 3ds max directory but in Plugins folder instead.

0 Likes

istan
Advisor
Advisor

For BMM.DLL e.g. these DLLs are not marked as not found on my machine...

0 Likes

chrisdawlud
Enthusiast
Enthusiast

Considering that there is already an OpenImageIO.dll (1.8.0) inside Max directory, I have build OpenImageIO (1.8.0) and linked my project to the import library. Now, apart from not having the most recent version, it all works fine.

0 Likes