.NET Core generation support
Whilst in an ideal world, it would be great to both run CppSharp on .NET and generate code for .NET Core I think currently it would suffice to just be able to generate code that is compatible with .NET Core. It would be great to be able to support all the new platforms that are to be added (OS X, Linux, FreeBSD) in the Microsoft framework, meaning that we wouldn't always need Mono there when wanting to use a CppSharp bound library.
+1. What specific issues have you run into?
The primary issue I have noticed is that SuppressUnmanagedSecurity is emitted.
On Mon, 7 Mar 2016, 16:41 Nathanael Jones, [email protected] wrote:
+1. What specific issues have you run into?
— Reply to this email directly or view it on GitHub https://github.com/mono/CppSharp/issues/629#issuecomment-193337705.
SuppressUnmanagedSecurity is unfortunately vital to us because it skips certain checks when calling into native code thus significantly increasing performance. In order to solve this, we need more details. For example, is the problem that SuppressUnmanagedSecurity causes some problem with .NET Core or rather that it doesn't exist at all? Is there an alternative to it? In case there is, is there a #define we can place in the generated code to detect .NET Core?
All P/Invoke's on CoreCLR effectively have this https://github.com/dotnet/coreclr/issues/1605
On Mon, 7 Mar 2016 at 17:13 Dimitar Dobrev [email protected] wrote:
SuppressUnmanagedSecurity is unfortunately vital to us because it skips certain checks when calling into native code thus significantly increasing performance. In order to solve this, we need more details. For example, is the problem that SuppressUnmanagedSecurity causes some problem with .NET Core or rather that it doesn't exist at all? Is there an alternative to it? In case there is, is there a #define we can place in the generated code to detect .NET Core?
— Reply to this email directly or view it on GitHub https://github.com/mono/CppSharp/issues/629#issuecomment-193351893.
If that is the only issue on .NET Core then we can easily fix it, though ideally we should also integrate CoreCLR on the CI system to test against it on every commit.
can we have a simple tutorial or example using a known c++ library to port it to .NET Core? If such a tutorial already available, please share the links
@JimSEOW: You can use https://github.com/ddobrev/QtSharp as an example, or all the other open source projects linked on the README file. And you can also take a look at our test suite.
Thanks @tritao, after extensive search through internet, I found (especially Japanese sites) offering step by step tutorials using the foo example. Thanks. cppSharp offers a much simpler experience than SWIG.
CppSharp can now be compiled under .NET Core.
However the P/Invoke support in .NET Core is buggy on Linux, so we'll have to wait until support is fixed upstream.
https://github.com/dotnet/coreclr/issues/22087
@tritao the fix for dotnet/coreclr#22087 should be in Preview 4.
Awesome thanks for the fix! 👍
To use the nuget package under netcore 2.2, it is needed to recompile this project and generate the output as nuget package?