#Static library

1 messages · Page 1 of 1 (latest)

ancient dagger
#

The library is native, not managed. I forgot to mention that in the post.

kindred frigate
#

You would need to create a C++ wrapper around the Static Library which then you could build as a DLL. You should first look if there is a DLL equivalent of your static library or, even better, a library that provides interfacing between the static library and the C#/Unity. (Something like a console SDK) Working directly with DLLImport may not be a good idea, it would be better to encapsulate it in a managed c# object to increase the maintainability.

ancient dagger
#

I'm building the library myself and it wouldn't be a dll since that's a dynamic library. It looks like .lib isn't supported by unity even though other static library types are supported.

For clarity, l have built working static libraries for the other platforms the project is hitting.

Unless you are suggesting renaming the .lib to .dll and that would work?

kindred frigate
#

If you are building the library yourself, what prevent you from doing a DLL ?

#

Because static library is not supported in C#.

kindred frigate
#

It is possible to use a ".a" files with [DllImport("__Internal"] on a native library due to the usage of IL2CPP. Whenever I say it is not possible to include static library in C# is true, but in case of Unity, with IL2CPP it is different.

#

So, what is the platform you are looking to include a ".lib" ? Is it windows ? If so, I'm afraid that IL2CPP might not link correctly with .lib files.

ancient dagger
#

All my platforms are il2cpp

#

But lib simply isn't recognized by the editor. I had issues on other platforms with building the plugin as a dynamic library and static was an easy workaround