C
C#16mo ago
Happypig375

❔ Any tutorial on wrapping an open source C++ library for providing a cross-platform NuGet package?

The library in specific is https://github.com/NanoMichael/MicroTeX and I would want to provide a NuGet package that users can just install and use just like SkiaSharp on any .NET platform (Windows, Linux, Mac, iOS, Android, Browser). Using latest .NET practice is desirable - like LibraryImport from .NET 7.
GitHub
GitHub - NanoMichael/MicroTeX: A dynamic, cross-platform, and embed...
A dynamic, cross-platform, and embeddable LaTeX rendering library - GitHub - NanoMichael/MicroTeX: A dynamic, cross-platform, and embeddable LaTeX rendering library
9 Replies
Tarcisio
Tarcisio16mo ago
You have to use P/Invoke and add the .dll, .so or .dylib files along with your dotnet project Why would you need a tutorial on that, it is pretty straight forward, just search for the docs on DllImport and learn a bit of P/Invoke
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
Happypig375
Happypig375OP16mo ago
yes so compiling for each and every platform combination? No .NET 7 LibraryImport?
Tarcisio
Tarcisio16mo ago
The difference between DllImport and LibraryImport is that Dllimport might emit dynamic stubs and increase working set + regress startup time However there is the [DisableRuntimeMarshalling] to have your DllImports be implicitly marshalling free. Which makes the LibraryImport kind of useless. But I guess you should be using LibraryImport, most likely won't make much of a difference but learn P/Invoke and how to ship the dependency files within your nuget package
Happypig375
Happypig375OP16mo ago
Most P/Invoke tutorials assume Windows which is why I wanted another tutorial that would cover cross platform Windows/Linux/macOS/iOS/Android/Browser starting from source code and not compiled binaries
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX16mo ago
Happypig375
Hiii
Quoted by
<@434214131122438144> from #allow-unsafe-blocks (click here)
React with ❌ to remove this embed.
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server