1

I need some assistance to export a GO dll function to a C program.

The C program (which I'm not the author) required to call a function with this name: _RVExtension@12

so, I simply declare my go function like this:

//export _RVExtension@12
func _RVExtension@12(output *C.char, outputsize C.size_t, input *C.char) {Saisissez le code ici...

but when I try to compile it, it returns an illegal character U+0040 '@' error.

Do you know if there is a workaround about this? I'm not familiar with C code and I don't understand why there is @12 in the function name.

note: for the 64 bits the entry point is simple : RVExtension and it works perfectly well.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Alexis 74
  • 11
  • 2
  • The `@12` is the size of the args, and tells you it needs to be declared with the `__stdcall` x86 calling convention Or it might be `__fastcall`, IDK what Go uses (but something with callee pops, so it will return with an x86 asm `ret 12` instruction). So `__stdcall func RVExtension( args );` might work for some compilers. Or for GNU C compilers (gcc/clang), maybe `__attribute__((stdcall))`. I don't have a Windows system to test this on, so not posting an answer. – Peter Cordes Jun 23 '19 at 13:57
  • 1
    Apparently the solution at the bottom of this golang github entry worked: https://github.com/golang/go/issues/32851 – Michael Petch Jul 29 '22 at 21:41

0 Answers0