在C ++中使用Delphi DLL [英] Using a Delphi DLL in C++

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

问题描述

如何使用在我的C ++项目(控制台应用程序)中用Delphi编写的DLL?

How can I use a DLL written in Delphi in my C++ project (console application)?

我已经阅读过关于wrappers。有比这更容易的方法吗?

I have already read about wrappers. Is there an easier way than that? Or how does this method (wrapper) work?

推荐答案

如果你正在用C ++ Builder编译你的C ++项目,这是微不足道的。只需在你的代码中包含由Delphi编译器生成的C ++包装器头文件,并将你的代码与Delphi库的stubs链接起来。

It is trivial if you are compiling your C++ project with C++Builder. Just include in your code the C++ wrapper headers generated by the Delphi compiler and link your code with the Delphi library stubs.

然而,我不知道如果你没有访问包装器,Delphi源代码或Delphi编译器,你可以管理它。在这种情况下,或者如果您不使用C ++ Builder,则必须应用DLL的典型用法,如果Delphi代码将OO功能导出为COM对象,则遵循标准调用约定和COM规则。

However I am not sure if you can manage to do it if you do not have access to wrappers, Delphi source code or Delphi compiler. In such a case or if you are not using C++Builder you must apply typical usage of DLLs and follow standard call convention and COM rules if Delphi code is exporting OO features as COM objects.

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

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