I am trying to import a third-party static library as a plugin into unity. I copied the library to Assets/Plugins/x64 folder and set the OS of the Plugin to Windows and architecture to x64. However, while it compiles the code fine, when I run the scene that uses the code from this static library, it complains DllNotFoundException: cspice assembly: type: member:(null). Can Unity import static libraries? I have this static library imported using the PINVOKE feature like this:
[DllImport("cspice")] public extern static void furnsh_c(string file);
I can confirm that the script for these PINVOKE statements and the static library (cspice.lib) are located in the same directory. Note that I don't have this issue with plugins that have a dynamic link library (DLL).
I would any suggestions/recommendations to get this working.
Thanks, Datri
To update the outdated answer. If using IL2CPP Scripting backend rather than Mono, it's now possible to link against static libs because IL2CPP uses ahead of time compilation while Mono uses Just in time compilation.are you usingIL2CPP?"cspice"? like e.g."./cspice.lib"or try a path relative toAssets.. alternatively also try__Internal.. Unity might be including the plugins directly .. tbh these are all just guesses, I'm not very deep into native plugins either. Here is a lot to read about that in more detail mono-project.com/docs/advanced/pinvoke (Mono specific)__Internalspec?