从Borland DLL导出C ++类并在Microsoft VC中使用它 [英] Export C++ class from a Borland DLL and use it in Microsoft VC

查看:69
本文介绍了从Borland DLL导出C ++类并在Microsoft VC中使用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我是这个小组的新手,我不知道这是不是正确的小组

我的问题。

我有一个带有导出库(.lib)的DLL在Borland C ++ 6中编写。在

borland一切正常,我能够包含lib并使用

我已经导出的类创建了一个带有new等的实例...我想要在Microsoft VC ++中使用相同的.lib导出这个类。

文件。显然它不起作用。


是否可以生成或转换导入库为

兼容格式?

提前谢谢


法布里

解决方案

我''这个组的新人,我不知道这是不是正确的组


我的问题。

我有一个带有它的DLL导出库(.lib)在Borland C ++ 6中写道。在

borland中,一切正常,我可以包含lib并使用我已导出的

类创建一个带有new等的实例...我想要使用相同的.lib

文件在microsoft VC ++中导出这个类。显然它不起作用。


是否可以生成或转换导入库为

兼容格式?



Nope。


编译的C ++代码没有二进制标准。每个编译器都使用它的b
自己的二进制布局。

这意味着C ++代码在不同的编译器之间是不兼容的,并且即使是不同的编译器版本也是如此。


在msvc中使用B​​orland C ++ dll是不可能的。

这不是微软的问题btw。所有编译器都是如此。微软

甚至有很好的兼容性记录,gcc最差。


如果要导出C ++代码,你必须坚持使用1个编译器。 br />
如果你想混合不同的编译环境,你必须坚持使用

ANSI C接口。


-


亲切的问候,

Bruno van Dooren
br ********************** @ hotmail.com

仅删除_nos_pam


Bruno van Dooren [MVP VC ++]写道:


>我是这个小组的新手,我不知道这是否是我的问题的正确组。
我有一个带有导出库的DLL(.lib )在Borland C ++ 6中写道。在
borland,一切正常,我能够包含lib并使用我已导出的
类创建一个新的实例等...我
我想o使用相同的.lib
文件在microsoft VC ++中导出此类。显然它不起作用。

是否可以生成或转换导入库为
兼容格式?



Nope。


编译的C ++代码没有二进制标准。每个编译器都使用它的b
自己的二进制布局。

这意味着C ++代码在不同的编译器之间是不兼容的,并且即使是不同的编译器版本也是如此。


在msvc中使用B​​orland C ++ dll是不可能的。



我想,那不是真的。例如,我使用用英特尔编写的DLL

Fortran和Borland C ++。恕我直言DLL使用是编译器 - 即使 -

语言独立。如果它真的不能与MS编译器一起使用(我没有这么做),那实际上是微软的问题。


Markus


这不是微软的问题btw。所有编译器都是如此。微软

甚至有很好的兼容性记录,gcc最差。


如果要导出C ++代码,你必须坚持使用1个编译器。 br />
如果你想混合使用不同的编译器环境,你必须使用

ANSI C接口。


< blockquote>>>我是这个组的新手,我不知道这是不是正确的组


>>对于我的问题。
我有一个带有导出库(.lib)的DLL在Borland C ++ 6中写道。在
borland,一切都很好,我能够包含lib并使用我导出的
类创建一个新的实例等...我想使用相同的.lib
文件在microsoft VC ++中导出这个类。显然它不起作用。

是否可以生成或转换导入库为
兼容格式?


没有。

编译的C ++代码没有二进制标准。每个编译器都使用它自己的二进制布局。
这意味着C ++代码在不同的编译器之间是不兼容的,甚至是不同的编译器版本。

使用Borland C ++ dll msvc是不可能的。



我想,那不是真的。例如,我使用用英特尔编写的DLL

Fortran和Borland C ++。恕我直言DLL使用是编译器 - 即使 -

语言独立。如果它真的不能与MS编译器一起工作(我没有这么做),那实际上是微软的问题。



不正确。

问题显然是关于从dll导出的C ++类。

Of当然,可以使用任何C / C ++编译器创建dll。


但是编译的C ++类在不同的C ++编译器之间是不兼容的。

这无关与微软。这是因为它花了很长时间才使C ++标准化,而不同的供应商花了很多时间来做自己的事情。


Borland与microsoft不兼容与gcc不兼容

与icc不兼容是...与C ++类不相容

关注。


DLL使用本身没问题。问题是,那个dll里面的内容不是一个类,因为msvc会编译它。

因此,它不起作用。
< br $>
-


亲切的问候,

Bruno van Dooren
BR ********************** @ hotmail的.com

仅删除_nos_pam


Hi All,

I''m new of this group and I do not know if this is the correct group
for my question.
I have a DLL with its export library (.lib) wrote in Borland C++ 6. In
borland everything is OK and I am able to include the lib and use the
class that i have exported creating an instance with new etc... I
would like to export this class in microsoft VC++ using the same .lib
file. Obviously it doesn'' t work.

Is it possible to generate or convert the import library into a
compatible format?

Thank you in advance

Fabry

解决方案

I''m new of this group and I do not know if this is the correct group

for my question.
I have a DLL with its export library (.lib) wrote in Borland C++ 6. In
borland everything is OK and I am able to include the lib and use the
class that i have exported creating an instance with new etc... I
would like to export this class in microsoft VC++ using the same .lib
file. Obviously it doesn'' t work.

Is it possible to generate or convert the import library into a
compatible format?

Nope.

There is no binary standard for compiled C++ code. Each compiler uses its
own binary layout.
This means that C++ code is incompatible between different compilers, and
even different compiler version.

Using Borland C++ dlls in msvc is not possible.
This is not a Microsoft problem btw. It is true for all compilers. Microsoft
even has a very good record for compatibility, gcc the worst.

If you want to export C++ code you have to stick with 1 compiler.
If you want to mix different compiler environments, you have to stay with
ANSI C interfaces.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"


Bruno van Dooren [MVP VC++] wrote:

>I''m new of this group and I do not know if this is the correct group
for my question.
I have a DLL with its export library (.lib) wrote in Borland C++ 6. In
borland everything is OK and I am able to include the lib and use the
class that i have exported creating an instance with new etc... I
would like to export this class in microsoft VC++ using the same .lib
file. Obviously it doesn'' t work.

Is it possible to generate or convert the import library into a
compatible format?


Nope.

There is no binary standard for compiled C++ code. Each compiler uses its
own binary layout.
This means that C++ code is incompatible between different compilers, and
even different compiler version.

Using Borland C++ dlls in msvc is not possible.

I think, that''s not true. For example, I use a DLL written in Intel
Fortran with Borland C++. IMHO DLL-usage is compiler - and even though -
language independant. If it really doesn''t work with the MS compiler (I
did not do this), it is in fact a Microsoft problem.

Markus

This is not a Microsoft problem btw. It is true for all compilers. Microsoft
even has a very good record for compatibility, gcc the worst.

If you want to export C++ code you have to stick with 1 compiler.
If you want to mix different compiler environments, you have to stay with
ANSI C interfaces.


>>I''m new of this group and I do not know if this is the correct group

>>for my question.
I have a DLL with its export library (.lib) wrote in Borland C++ 6. In
borland everything is OK and I am able to include the lib and use the
class that i have exported creating an instance with new etc... I
would like to export this class in microsoft VC++ using the same .lib
file. Obviously it doesn'' t work.

Is it possible to generate or convert the import library into a
compatible format?


Nope.

There is no binary standard for compiled C++ code. Each compiler uses its
own binary layout.
This means that C++ code is incompatible between different compilers, and
even different compiler version.

Using Borland C++ dlls in msvc is not possible.


I think, that''s not true. For example, I use a DLL written in Intel
Fortran with Borland C++. IMHO DLL-usage is compiler - and even though -
language independant. If it really doesn''t work with the MS compiler (I
did not do this), it is in fact a Microsoft problem.

Not true.
The question is clearly about C++ classes that are exported from a dll.
Of course, dlls can be created with any C/C++ compiler.

But compiled C++ classes are NOT compatible between different C++ compilers.
This has nothing to do with Microsoft. It is a result from the fact that it
took a very long time for C++ to be standardized, while different vendors
went along, doing their own thing.

Borland is incompatible with microsoft is incompatible with gcc is
incompatible with icc is incompatible with ... as far as C++ classes are
concerned.

DLL usage itself is no problem. The problem is that what''s inside that dll
is not a class as msvc would have compiled it.
Hence, it does not work.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"


这篇关于从Borland DLL导出C ++类并在Microsoft VC中使用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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