Linking library without a header file?

前端 未结 4 2183
谎友^
谎友^ 2021-02-02 17:57

I\'m attempting to link a static library in C++ using Visual Studio 2010. Trouble is, the library (and accompanying header ) have a lot of MFC objects in them. I would like to c

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-02 18:37

    You can absolutely do this, you just have to find the exact right function prototype.

    Use "dumpbin" to dump the symbol table, and look for your function.

    If the function name looks normal - then define it, and link to it using "extern C". If the symbol is c++ mangled, then you will need to demangle it to find the prototype.

    If the function is not in the symbol table - then it has been defined statically in the lib, and is not accessible. Then you're hosed. There is no way.

提交回复
热议问题