将C ++类导出为序数(通过def文件) [英] Exporting C++ classes as ordinals (via a def file)

查看:116
本文介绍了将C ++类导出为序数(通过def文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用序数#而不是

按名称导出我的C ++类在DLL中。有人会关注通过这个步骤来计算这个吗?


我已经失败了导出类和符号(包括C ++和C)。在C函数的情况下,我也知道如何导出它们

by ordinal# - 我的主要问题围绕如何进行ff:


1 )。从C ++ DLL中获取受损的名称

2)。如何将它们(如果需要任何映射)映射到def

文件中的名称。

解决方案



" 2b |!2b ==?" < ro ** @ your.box.com写了留言

新闻:wc ********************* @ bt.com。 ..


>我想在DLL中导出我的C ++类,使用序数# - 而不是
名称。是否有人愿意通过执行此操作所需的步骤进行枚举?


我已经失败了导出类和符号(包括C ++和C)

来自a DLL。在C函数的情况下,我也知道如何通过

ordinal#来导出它们 - 我的主要问题围绕如何进行ff:


1 )。从C ++ DLL中获取受损的名称



Dependency Walker是你的朋友。


2)。如何将它们(如果需要任何映射)映射到def

文件中的名称。






Ben Voigt写道:


" 2b |!2b ==?" < ro ** @ your.box.com写了留言

新闻:wc ********************* @ bt.com。 ..


>>我想在DLL中导出我的C ++类,使用序数# - 而不是
名称。是否有人愿意通过执行此操作所需的步骤进行枚举?

我已经失败了从DLL导出类和符号(包括C ++和C)。在C函数的情况下,我也知道如何通过序数#导出它们 - 我的主要问题围绕如何进行ff:

1)。从C ++ DLL中获取受损的名称




Dependency Walker是你的朋友。



当然,必须有一个更好的方法,而不是手动通过(复制和

粘贴?)100多个(Class :: methods)PER Dll?


>


>> 2)。如何将它们(如果需要任何映射)映射到def
文件中的名称。



我是否在.def文件中使用相同的装饰名称,或者我需要

" munge" (例如,使用另一个

工具将名称转换成其他东西?


" 2b |!2b ==?" < ro ** @ your.box.com写在留言中

新闻:************************** **** @ bt.com ...


>


Ben Voigt写道:
< blockquote class =post_quotes>
>" 2b |!2b ==?" < ro ** @ your.box.com在消息新闻中写道:wc ********************* @ bt.com ...


>>>我想在DLL中导出我的C ++类,使用序数# - 而不是名称。是否有人愿意通过执行此操作所需的步骤进行枚举?

我已经失败了从DLL导出类和符号(包括C ++和C)。在C函数的情况下,我也知道如何通过序数#导出它们 - 我的主要问题
围绕如何进行ff:

1)。从C ++ DLL中获取受损的名字



Dependency Walker是你的朋友。



当然,必须有比手动通过(复制和粘贴?)更好的方式超过100 +

(Class :: methods)PER Dll?


>>


>>> 2)。如何将它们(如果需要任何映射)映射到def文件中的名称。



我是否在.def文件中使用相同的装饰名称,或者我是否需要munge (例如,

转换)使用其他工具将名称转换成其他东西?




你在谈论班级成员吗?如果是,请停在这里,你不能从托管的

代码中调用方法,只能通过PInvoke调用C风格的导出,你需要将它们包装在托管中

使用C ++ / CLI的类。

如果你在谈论C风格函数,你必须使用 -

dumpbin / exports< dllnameand add来查找导出序数他们手动进入你的DllImports,IMO没有工具

自动执行此操作。


Willy。


I want to export my C++ classes in a DLL, using ordinal # - rather than
by name. Will anyone care to enumerate through the steps required to do
this?

I am already failiar with exporting classes and symbols (both C++ and C)
from a DLL. In the case of C functions, i also know how to export them
by ordinal # - my main problem revolves around how to do the ff:

1). Obtaining the mangled names from the C++ DLL
2). How to map them (if any mapping is required) to the names in the def
file.

解决方案


"2b|!2b==?" <ro**@your.box.comwrote in message
news:wc*********************@bt.com...

>I want to export my C++ classes in a DLL, using ordinal # - rather than by
name. Will anyone care to enumerate through the steps required to do this?

I am already failiar with exporting classes and symbols (both C++ and C)
from a DLL. In the case of C functions, i also know how to export them by
ordinal # - my main problem revolves around how to do the ff:

1). Obtaining the mangled names from the C++ DLL

Dependency Walker is your friend.

2). How to map them (if any mapping is required) to the names in the def
file.





Ben Voigt wrote:

"2b|!2b==?" <ro**@your.box.comwrote in message
news:wc*********************@bt.com...

>>I want to export my C++ classes in a DLL, using ordinal # - rather than by
name. Will anyone care to enumerate through the steps required to do this?

I am already failiar with exporting classes and symbols (both C++ and C)
from a DLL. In the case of C functions, i also know how to export them by
ordinal # - my main problem revolves around how to do the ff:

1). Obtaining the mangled names from the C++ DLL



Dependency Walker is your friend.

Surely, there must be a better way than manually going through (copy and
paste?) over 100+ (Class::methods) PER Dll ?

>

>>2). How to map them (if any mapping is required) to the names in the def
file.

Do I use the same decorated names in the .def file, or do I need to
"munge" (i.e. transform) the names into something else using another
tool for example ?


"2b|!2b==?" <ro**@your.box.comwrote in message
news:of******************************@bt.com...

>

Ben Voigt wrote:

>"2b|!2b==?" <ro**@your.box.comwrote in message news:wc*********************@bt.com...

>>>I want to export my C++ classes in a DLL, using ordinal # - rather than by name. Will
anyone care to enumerate through the steps required to do this?

I am already failiar with exporting classes and symbols (both C++ and C) from a DLL. In
the case of C functions, i also know how to export them by ordinal # - my main problem
revolves around how to do the ff:

1). Obtaining the mangled names from the C++ DLL



Dependency Walker is your friend.


Surely, there must be a better way than manually going through (copy and paste?) over 100+
(Class::methods) PER Dll ?

>>

>>>2). How to map them (if any mapping is required) to the names in the def file.


Do I use the same decorated names in the .def file, or do I need to "munge" (i.e.
transform) the names into something else using another tool for example ?



Are you talking about class members? If yes, stop here, you can''t call methods from managed
code, only C style exports can be called via PInvoke, you need to wrap them in managed
classes using C++/CLI.
If you are talking about C style functions, you''ll have to find the export ordinals using -
dumpbin /exports <dllnameand add them manually into your DllImports, IMO there is no tools
to do this automatically.

Willy.


这篇关于将C ++类导出为序数(通过def文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆