Strange dumpbin export table

牧云@^-^@ 提交于 2019-12-13 05:04:54

问题


Am interoping a c++ dll and am attempting to access it's functions. Below is the dumpbin /exports output from the dll:

Dump of file C:\C#Processes\SummarizerApp\SummarizerApp\lib\summarizer37.dll
File Type: DLL
Section contains the following exports for summarizer37.dll

00000000 characteristics
458962FF time date stamp Wed Dec 20 11:21:19 2006
    0.00 version
       1 ordinal base
       4 number of functions
       4 number of names

ordinal hint RVA      name

      1    0 00002960 ?delete_summarization@inxight@@YAXPAVsummarization_interface@1@@Z
      2    1 00016240 ?delete_summarizer@inxight@@YAXPAVsummarizer_interface@1@@Z
      3    2 000105E0 ?make_summarization@inxight@@YAPAVsummarization_interface@1@AAVsummarizer_interface@1@AAVbyte_stream_interface@1@ABVsummarization_input_options@1@ABVsummarization_sentence_output@1@ABVsummarization_phrase_output@1@PBDI5@Z
      4    3 0001BC40 ?make_summarizer@inxight@@YAPAVsummarizer_interface@1@PBD00@Z

Summary

    4000 .data
    B000 .rdata
    4000 .reloc
   2E000 .text

Take note of ordinal #3. It includes several methods I need to call, specifically:
make_summarization
summarization_input_options
summarization_sentence_output
summarization_phrase_output

Have done a JNI wrap of this dll and know that the functions above (which are all class contructors) are available from "extern C" which JNI uses, in unmangled form. Can I use the calling convention property of dllimport to access them undecorated?

In the C++ world what does it mean when multiple functions are exported under the same ordinal and what is the method of accessing them? Thanks, Jim


回答1:


The EntryPoint field of the DllImport attribute can be used to import functions by ordinal (prefix the ordinal with a #).
It can also be used to import functions by their mangled name.
If you really have pure "extern C" wrappers for all of the functionality exposed by the C++ library, that makes this easy.
If you do not, you can construct C++/CLI wrappers to bridge between managed and unmanaged.

undname.exe in the vc\bin folder can be used to demangle compiled C++ names:

class inxight::summarization_interface * __cdecl inxight::make_summarization(
   class inxight::summarizer_interface &,
   class inxight::byte_stream_interface &,
   class inxight::summarization_input_options const &,
   class inxight::summarization_sentence_output const &, 
   class inxight::summarization_phrase_output const &,
   char const *, unsigned int , char const *)


来源:https://stackoverflow.com/questions/2592690/strange-dumpbin-export-table

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!