AaronRobinsonMSFT / DNNE

Prototype native exports for a .NET Assembly.
MIT License
394 stars 41 forks source link

Question About Usage #141

Closed js10x closed 1 year ago

js10x commented 1 year ago

Are the exports generated by this package usable in C-GO or are they only usable in C/C++? I've attempted to export a function using the "UnmanagedCallersOnly" attribute to be consumed with Go code via the C-GO interface, but received the following error.

Context: Exported C# Function Name: MyExport OS: Windows

../mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: $WORK\b001_x002.o: in function _cgo_64fb08122b0a_Cfunc_MyExport': /tmp/go-build/cgo-gcc-prolog:54: undefined reference to `MyExport' collect2.exe: error: ld returned 1 exit status

AaronRobinsonMSFT commented 1 year ago

Are the exports generated by this package usable in C-GO or are they only usable in C/C++?

@JS10X Yes, they should be. The C-GO packages is specifically targeted at supporting the C ABI so there should be no issues with consuming the exports from DNNE.

to be consumed with Go code

Consuming .NET from within a Go application to solve a problem is something I'd be interested in hearing about, if you are willing to share details.