import System.Collections.Generic
import System.Linq
import System.Text
import System.Threading.Tasks
public class Class1 {
@UnmanagedExport("name", System.Runtime.InteropServices.CallingConvention.Cdecl)
static func test() {}
}
The parameters to UnmanagedExport are optional, the first is the name, the second the calling convention. It defaults to the name of the function and winapi.
It does require “Unsafe Code” to be enabled, and it requires you to build for either x86 or x86_64.
If it’s java you need to use JNI. For Island the DllExport attribute can be used.
I have created a Island Class Library project which, once built, creates a
.dll file along with the .fx. but the DLL file when opened with Dependency
Walker shows that the export list is empty.
I read that in a Island C# DLL project you can use the DllExport attribute.
My question is: is there an equivalent of DllExport in Swift?
Thanks a lot! Now it works! I combined DllExport, SymbolName and
CallingConvention to achieve what I needed.
The only thing I still miss is the ability to have a “plain C” exported
name i.e. without the mangling which adds “@nn” at the end of the name of
the function.