问题描述
我有一个指向COM接口的指针,想从其虚拟表中获取函数指针并进行方法调用。为此,我需要进行stdcall方法调用。在Go中,如何在cgo中使用约定的stdcall进行呼叫或使用约定的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?
推荐答案
请参见 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
这篇关于如何从Go进行stdcall的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!