本文介绍了非dotnet DLLs:砖墙击中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正试图用C#找到我的脚,并打了一下墙。 我在用Delphi编写的DLL中有很多遗留代码。我不认为 这个用Delphi编写的事实应该会造成太多的问题,因为代码只是简单的Pascal算术和 字符串操作,以及所有字符串在传递给 和DLL的结构中实际上是char数组。 我想保留DLL以便在现有应用程序中使用,但 在C#应用程序中使用它。这些例程需要可用,并且可以为几个应用程序维护,包括传统的应用程序。 无论如何... 作为一个概念证明,我希望能够将一个应该传递给我的 介意,这是一个简单的结构(要处理的数据)到DLL和 将一个简单的结构(结果)返回给调用的C# 应用程序。 (我正在使用结构这个词来避免过于特定的b $ b;我甚至不确定我是否应该使用结构或类。) 我花了很长时间在新闻组中搜寻并尝试了各种各样的代码示例,但似乎没什么用。关于这个主题有很多 的消息,有很多毫无疑问的有用建议,但是我认为如果我有工作的话,这些建议对我来说会更有意义。 /> 玩的例子。 所以,有没有人有米老鼠的传递和返回的例子 " structures" (从我不明确的意义上说)从C#应用程序到 非.NET DLL。 谢谢。 Gary Jones (请在此发送任何回复,而不是通过电子邮件发送。) Hi, I''m trying to find my feet with C# and have hit a bit of a wall. I have lots of legacy code in a DLL written in Delphi. I don''t thinkthe fact that it''s written in Delphi should cause too much of aproblem since the code is just simple Pascal that does arithmetic andstring manipulations, and all "strings" in the structures passed toand from the DLL are actually arrays of char. I want to retain the DLL for use in existing applications, but alsomake of it in C# applications. The routines need to be available andmaintainable for several applications, including legacy ones. Anyway... As a proof of concept, I want to be able to pass what should, to mymind, be a simple structure (data to be processed) to the DLL andreturn a simple structure (results) back to the calling C#application. (I''m using the word "structure" to avoid being toospecific; I''m not even sure if I should use a struct or a class.) I''ve spent ages trawling through newsgroups and tries all sorts ofexamples of code but nothing seems to quite work. There are manymessages on this subject with lots of no-doubt useful advice, but Ithink the advice will make more sense to me if I have a workingexample to play with. So, does anyone have a mickey-mouse example of passing and returning"structures" (in my ill-defined sense) from a C# application to anon-.NET DLL. Thanks. Gary Jones(Please send any replies here rather than by email.)推荐答案 嗨Gary 我怀疑我的很多代码都是''Micky Mouse'':-) 你能发布Delphi DLL期望的结构吗?我们可以 可能解释了如何用C#重新创建它。 - Jeff Gaines 发布于XanaNews 1.17.1.2 http://www.wilsonc.demon.co.uk/delphi.htm 如果他能在C#中传递一个Delphi字符串作为 a字符串,我会非常非常惊讶。 Delphi字符串需要在两个项目(dll和调用应用程序)中与Borland lib ShareMem的链接才能工作。 - ---- http://michael.moreno.free.fr / I would be very very very surprised if he could pass a Delphi string asa string in C#. Delphi string requires the link with the Borland libShareMem in both projects (dll and calling app) to work. ------ http://michael.moreno.free.fr/ 这篇关于非dotnet DLLs:砖墙击中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-25 00:10