非dotnet DLLs:砖墙击中 [英] Non-dotnet DLLs: brick wall hit

查看:69
本文介绍了非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 think
the fact that it''s written in Delphi should cause too much of a
problem since the code is just simple Pascal that does arithmetic and
string manipulations, and all "strings" in the structures passed to
and from the DLL are actually arrays of char.

I want to retain the DLL for use in existing applications, but also
make of it in C# applications. The routines need to be available and
maintainable for several applications, including legacy ones.

Anyway...

As a proof of concept, I want to be able to pass what should, to my
mind, be a simple structure (data to be processed) to the DLL and
return a simple structure (results) back to the calling C#
application. (I''m using the word "structure" to avoid being too
specific; 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 of
examples of code but nothing seems to quite work. There are many
messages on this subject with lots of no-doubt useful advice, but I
think the advice will make more sense to me if I have a working
example 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 a
non-.NET DLL.

Thanks.

Gary Jones
(Please send any replies here rather than by email.)

推荐答案

你可以简单将一个pascal字符串作为字符串传递,将pchar作为StringBuilder传递给你的dll中的函数。这是你想听到的吗?

也许你可能会更具体一点。


Gary Jones <无********** @ hotmail.com> schrieb im Newsbeitrag

新闻:1f ************************** @ posting.google.c om ...
You can simply pass a pascal string as string, and pchar as StringBuilder to
the functions in your dll. Is that what you wanted to hear?
Maybe you could be a bit more specific.

"Gary Jones" <no**********@hotmail.com> schrieb im Newsbeitrag
news:1f**************************@posting.google.c om...


我正试图用C#找到我的脚并且碰到了一堵墙。

我有很多用Delphi编写的DLL中的遗留代码。我不认为它是用Delphi编写的这个事实应该引起太多的问题,因为代码只是简单的Pascal,它可以进行算术和字符串操作,以及所有字符串传递给
和DLL的结构实际上是char的数组。

我想保留DLL以便在现有的应用程序中使用,而且还要在C#中使用它应用。这些例程需要可用并且可以维护多个应用程序,包括遗留应用程序。

无论如何...

作为概念证明,我想成为能够传递应该是什么,我的心灵,是一个简单的结构(要处理的数据)到DLL和
返回一个简单的结构(结果)回到调用C#
应用程序。 (我正在使用结构这个词来避免过于具体;我甚至不确定我是否应该使用结构或类。)

我我花了很多年的时间在新闻组中搜寻并尝试各种各样的代码示例,但似乎没什么用。有很多关于这个主题的消息,有很多毫无疑问的有用的建议,但我认为如果我有一个工作的例子,这个建议对我来说会更有意义。

那么,有没有人有一个传递和返回
结构的米老鼠示例。 (从我不明确的意义上说)从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 think
the fact that it''s written in Delphi should cause too much of a
problem since the code is just simple Pascal that does arithmetic and
string manipulations, and all "strings" in the structures passed to
and from the DLL are actually arrays of char.

I want to retain the DLL for use in existing applications, but also
make of it in C# applications. The routines need to be available and
maintainable for several applications, including legacy ones.

Anyway...

As a proof of concept, I want to be able to pass what should, to my
mind, be a simple structure (data to be processed) to the DLL and
return a simple structure (results) back to the calling C#
application. (I''m using the word "structure" to avoid being too
specific; 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 of
examples of code but nothing seems to quite work. There are many
messages on this subject with lots of no-doubt useful advice, but I
think the advice will make more sense to me if I have a working
example 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 a
non-.NET DLL.

Thanks.

Gary Jones
(Please send any replies here rather than by email.)



05/01/2005 Gary Jones写道:
On 04/01/2005 Gary Jones wrote:

那么,有没有人有一个传递和返回
结构的米老鼠示例。 (从我不明确的意义上说)从C#应用程序到非.NET DLL。

So, does anyone have a mickey-mouse example of passing and returning
"structures" (in my ill-defined sense) from a C# application to a
non-.NET DLL.




嗨Gary


我怀疑我的很多代码都是''Micky Mouse'':-)


你能发布Delphi DLL期望的结构吗?我们可以

可能解释了如何用C#重新创建它。

-

Jeff Gaines

发布于XanaNews 1.17.1.2 < a rel =nofollowhref =http://www.wilsonc.demon.co.uk/delphi.htmtarget =_ blank> http://www.wilsonc.demon.co.uk/delphi.htm


>您可以简单地将pascal字符串作为字符串传递,将pchar作为StringBuilder传递给
> You can simply pass a pascal string as string, and pchar as StringBuilder to
您的dll中的函数。那是你想听到的吗?
the functions in your dll. Is that what you wanted to hear?




如果他能在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 as
a string in C#. Delphi string requires the link with the Borland lib
ShareMem in both projects (dll and calling app) to work.

--
----
http://michael.moreno.free.fr/


这篇关于非dotnet DLLs:砖墙击中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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