3

I have a pointer to a COM interface and would like to take the function pointers from its virtual table and make method calls. To do this I need to make stdcall method calls. In Go how do I make a call with convention stdcall or make a call with convention stdcall in cgo?

user782220
  • 10,677
  • 21
  • 72
  • 135

1 Answers1

1

See "godoc syscall Proc" for instructions on how to call stdcall functions on windows. Be warned that *Proc.Call does allocate / deallocate memory, so, if you care about efficiency, you should use correspondent syscall.Syscall/syscall.Syscall6/syscall.Syscall9/... function instead.

Alex

alex
  • 2,178
  • 16
  • 14
  • 1
    If I'm making a normal function call with stdcall calling conventions that is not a system call, how does it make sense to use Syscall()? – user782220 Jul 23 '12 at 01:07
  • 1
    syscall.Syscall is platform specific. On windows it uses stdcall convention to call functions inside of dlls. See http://code.google.com/p/go/source/browse/src/pkg/syscall/zsyscall_windows_386.go for many examples of how to do it. – alex Jul 24 '12 at 09:47