Open nitanmarcel opened 3 years ago
The binding library is platform neutral. ABI difference among supported platforms should be handled well by P/Invoke.
The use of native library NuGet packages is optional. It just helps you copy native libraries to the output directory when using .NET Core SDK. When published targeting a specific runtime ID, the meta native package will automagically reference a runtime package (containing native libraries) for that runtime.
The binding library is platform neutral. ABI difference among supported platforms should be handled well by P/Invoke.
The use of native library NuGet packages is optional. It just helps you copy native libraries to the output directory when using .NET Core SDK. When published targeting a specific runtime ID, the meta native package will automagically reference a runtime package (containing native libraries) for that runtime.
So what I should do more exactly?
Can I copy the precompiled binaries of tdlib to my output directory and the library will do everything for me or I need another way of doing this?
At last that's what tdsharp does, it detects the platform and automatically it will load the correct tdlib binary https://github.com/egramtel/tdsharp/tree/db87391fd0846ac818b2aa3ef077ed13837c946b/TDLib/Bindings
Can I copy the precompiled binaries of tdlib to my output directory and the library will do everything for me
In short, yes.
Given DllImport("tdjson")
, .NET Core runtime (on non-Windows platform) will try to load the library with different prefix/suffix combinations, which will fall in CMake's default shared library naming convention on target platform (libtdjson.so
etc).
https://github.com/dantmnf/tdlib-netcore/blob/25c5a33f04f7fc266ebdf338458ac88420e9b6d0/TDLibCore.JsonClient/Native.cs#L11
Can I copy the precompiled binaries of tdlib to my output directory and the library will do everything for me
In short, yes.
Given
DllImport("tdjson")
, .NET Core runtime (on non-Windows platform) will try to load the library with different prefix/suffix combinations, which will fall in CMake's default shared library naming convention on target platform (libtdjson.so
etc). https://github.com/dantmnf/tdlib-netcore/blob/25c5a33f04f7fc266ebdf338458ac88420e9b6d0/TDLibCore.JsonClient/Native.cs#L11
Thanks for everything. I still have some errors in the code for which I will get to later, more exactly it's with the build-managed script (RuntimeError) but I still need to be at my PC.
What I want to ask now, could I use tdlib.native to build the binaries? (Since I can easily build for multiple platforms using travis.cli
could I use tdlib.native to build the binaries
Yes, but take care of tdlib API version. You may need to re-run codegen of this project, or change submodule reference of that project.
The build-managed script should work on a clean tree now.
How does this library handles on multiple platforms?
Do I have to have one project for each platform with their own tdlib-netcore reference or having it in just one project and the library will take care of handling multiple platforms? (Eg: Windows, Linux, MacOS)