Can someone tell me what are the plans regarding calling native code from code
running in the CoreCLR?
I try to port a C# project compiled against .NET2.0 to CoreCLR which uses lots of native
methods via DllImport (these are calling our C++ code and I have full control
also over this code base…). VS 2015 tells me that DllImport is not available
under “Core_mscorelibCoreClr.DNX Core 5.0” and by building it with “dnu build”
it also throws an error “The type or namespace name ‘DllImport’ could not be
I tried it with 1.0.0-beta4 shipped by VS2015 preview and with 1.0.0-beta5-12103.
Btw. I see lots of DllImports in the CoreCLR repo, and https://github.com/dotnet/corefx/issues/343
also states that DllImport works on CoreCLR.
So is DllImport supported? If yes, what is wrong with code like this:
[DllImport("myLib.dll", CallingConvention = CallingConvention.StdCall)] internal static extern long NativeMethod();