英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论