创建可以使用 stdcall 在 Delphi 应用程序中导入的 C# DLL - 可能吗? [英] Create a C# DLL That Can Be Imported in a Delphi App Using stdcall - Possible?

查看:40
本文介绍了创建可以使用 stdcall 在 Delphi 应用程序中导入的 C# DLL - 可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序需要为它创建一个 DLL,希望是在 C# 中.该程序是用 Delphi 编写的,我有一个要编码的接口文件.该接口使用 stdcall 调用约定.

I have a program that I need to create a DLL for, hopefully in C#. The program is written in Delphi and I have an interface file to code to. The interface uses the stdcall calling convention.

能否创建一个符合接口的C#DLL,可以在Delphi应用中使用?

Is it possible to create a C# DLL that conforms to the interface and can be used in the Delphi application?

是否有一些示例代码演示了如何将 C# DLL 编码为 stdcall 接口方法?

Is there some sample code that demonstrates how to code the C# DLL to a stdcall interface method?

推荐答案

这在纯 C# 中是不可能的,但是 这篇文章 展示了如何将非托管导出表添加到您的 C# 库中,然后可以在任何其他语言中使用该表.请注意,大量引用 Blitz 不应该让您失望 - 它们与作者自己的上下文有关,与基本概念及其工作原理无关.

This is not possible in pure C#, but this is an article that shows how to add an unmanaged export table to your C# library, which can then be used in any other language. Note that the hordes of references to Blitz should not put you off - they relate to the author's own context and have nothing to do with the basic concept and how it works.

布莱恩Long 的一篇会议论文.有点讽刺的是,Delphi.Net 实际上直接支持非托管导出,尽管 C# 没有这样做.我不知道 Delphi Prism 是否也是如此.

There is also a section in Brian Long's one conference paper. In a twist that you could see as somewhat ironic, Delphi.Net actually supported unmanaged exports directly despite C# not doing so. I have no idea if this is true of Delphi Prism as well.

这篇关于创建可以使用 stdcall 在 Delphi 应用程序中导入的 C# DLL - 可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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