Cant import dll in C++ application

前端 未结 1 366
旧巷少年郎
旧巷少年郎 2021-01-28 07:30

I have a dll called hecom32.dll. I want to use this in my application. I acll the following:

#import \"hecom32.dll\"

And I get the

1条回答
  •  情歌与酒
    2021-01-28 08:09

    This will only work properly if hecom32.dll implements a COM server and has the type library embedded as a resource. You can check that with File + Open + File, select the dll. You'll see the resources listed, there should be one labeled "TYPELIB" with a resource ID of 1 if you open the node.

    Surely that's missing, the error message says as much. Embedding a type library is a convention, it isn't required. Just keeping it separate as a .tlb file is possible as well. And of course, it might not be a COM server at all. You can see that by running Dumpbin.exe /exports on the dll. A COM server has at least an export named "DllGetClassObject".

    If none of this pans out then you'd better contact the owner of the DLL and ask for help on how to use it properly. Which typically requires having a .h file with the declarations of the exported functions and a .lib file so you can link it.

    0 讨论(0)
提交回复
热议问题