vtable 有问题——是我的问题,还是图书馆的问题?
我正在尝试使用一个利用 vtable 的 COM 库。 然而,在我调用函数后,堆栈发生了一些奇怪的事情,这告诉我我做错了什么。
带有 vtable 定义的头文件粘贴在这里: pastebin.com/m2d66c18c (特别参见从810 行)。 此处粘贴了一个示例:pastebin.com/m1b46e662。
表中填充了函数的正确位置,但是当我调用函数时,它们似乎在堆栈上的错误位置查找参数。 另外,调用表中的函数后,堆栈混乱,我的程序崩溃了。 我尝试将函数类型更改为 __cdecl
和 __stdcall
但这没有任何作用。
这要么是我的代码,要么是库,而编写库的公司还没有回复我——因为我假设是周末。 另外,有一个使用该库的演示应用程序,并且它可以工作——所以我认为这是我的代码/编译器(gcc)/其他东西,而不是库。
为了使用 COM 库,您是否需要做一些特别的事情?
I'm trying to use a COM library that makes use of a vtable. However, something funky is going on with the stack after I call the functions, which tells me I'm doing something wrong.
The header file with the vtable definition is pasted here: pastebin.com/m2d66c18c (see in particular the code starting at line 810). An example is pasted here: pastebin.com/m1b46e662.
The table is being filled with the correct locations for the functions, but when I call the function(s), they appear to be looking in the wrong locations for the arguments on the stack. Also, after calling the functions in the table, the stack is messed up and my program crashes. I've tried changing the function type to both __cdecl
and __stdcall
but this does nothing.
It's either my code or the library, and the company that wrote the library hasn't gotten back to me -- because it's the weekend, I'm assuming. Also, there is a demo application that utilizes the library, and it works -- so I think it's my code/compiler (gcc)/something else, not the library.
Could it be that there something in particular that you need to do in order to use a COM library?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论