如何在Go中使用stdcall

huangapple go评论124阅读模式
英文:

How to make stdcall from Go

问题

我有一个指向COM接口的指针,并且想要从它的虚函数表中获取函数指针并进行方法调用。为了做到这一点,我需要进行stdcall方法调用。在Go语言中,我如何进行stdcall约定的调用,或者如何在cgo中进行stdcall约定的调用?

英文:

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?

答案1

得分: 1

请参阅“godoc syscall Proc”以了解如何在Windows上调用stdcall函数。请注意,*Proc.Call会分配/释放内存,因此,如果您关心效率,应该使用相应的syscall.Syscall/syscall.Syscall6/syscall.Syscall9/...函数。

英文:

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

huangapple
  • 本文由 发表于 2012年7月22日 10:18:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/11597341.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定