Call function in c++ dll without header

前端 未结 6 559
借酒劲吻你
借酒劲吻你 2020-12-15 22:36

I would like to call a method from an dll, but i don\'t have the source neither the header file. I tried to use the dumpbin /exports to see the name of the method, but i can

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-15 23:24

    If you indeed know or strongly suspect the function is there, you can dynamically load the DLL with loadLibrary and get a pointer to the function with getProcAddress. See MSDN

    Note that this is a manual, dynamic way to load the library; you'll still have to know the correct function signature to map to the function pointer in order to use it. AFAIK there is no way to use the dll in a load-time capability and use the functions without a header file.

提交回复
热议问题