从Delphi迁移.... [英] Migrating from Delphi....

查看:80
本文介绍了从Delphi迁移....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的一些应用程序从Delphi迁移到C#。但是......


是的但是我不认识C#。我在这样的delphi中使用DLL:


.....

const

RFID_103_485IO =''Cihaz.dll '';


函数SearchPort(Prm1:LongWord):LongWord; CDECL;外部

RFID_103_485IO名称''SearchPort'';

功能CheckPort(Prm1:LongWord):LongWord; CDECL;外部

RFID_103_485IO名称''CheckPort'';

函数SearchReader(Prm1:LongWord; Prm2:LongWord):LongWord; cdecl;

外部RFID_103_485IO名称''SearchReader'';

函数CheckReader(Prm1:LongWord; Prm2:LongWord):LongWord; cdecl;

外部RFID_103_485IO名称''CheckReader'';


....


我正在使用它在德尔福:


.....

ResultNumber:= CheckReader(n,m);


....


但是如何在C#中使用我的DLL函数。我在我的

类中尝试下面的代码。但它不起作用。你能帮帮我吗?


使用System;


使用System.Runtime.InteropServices;


命名空间MyDllLoadClass


{


公共类阅读器


{


[DllImport(" Cihaz.dll",CallingConvention = CallingConvention.Cdecl)]

static extern void SearchPort(uint Prm1);

[DllImport(" Cihaz.dll",CallingConvention = CallingConvention.Cdecl)]

static extern int CheckPort(uint Prm1);


[DllImport(" Cihaz.dll",CallingConvention = CallingConvention.Cdecl)]

static extern void SearchReader(uint Prm1,uint Prm2);


}


}


我正在尝试在我的其他班级使用这个


label1.Text = Convert.ToString(MyDllLoadClass.Reader.CheckPort(i));


解决方案

我以为Borland带来了删除Delphi.net - 如果不是这样的话,那么最好保留你的代码库int delphi并将它们移到

delphi.net吗?

-


-


Br,

Mark Broadbent

mcdba,mcse + i

=============

" Arda Han" < AR ** @ han.com>在消息中写道

news:u6 ************** @ tk2msftngp13.phx.gbl ...

我正在迁移我的一些从Delphi到C#的应用程序。但是......

是的但是我并不专业地知道C#。我在delphi中使用DLL就像这样

....
const
RFID_103_485IO =''Cihaz.dll'';

功能SearchPort (Prm1:LongWord):LongWord; CDECL;外部
RFID_103_485IO名称''SearchPort'';
功能CheckPort(Prm1:LongWord):LongWord; CDECL;外部
RFID_103_485IO名称''CheckPort'';
功能搜索阅读器(Prm1:LongWord; Prm2:LongWord):LongWord; cdecl;
外部RFID_103_485IO名称''SearchReader'';
功能CheckReader(Prm1:LongWord; Prm2:LongWord):LongWord; cdecl;
外部RFID_103_485IO名称''CheckReader'';

...

我在Delphi中使用它:

。 ......
ResultNumber:= CheckReader(n,m);

...

但是如何在C#中使用我的DLL函数。我在我的
课程中尝试下面的代码。但它不起作用。你能帮我吗?

使用System;

使用System.Runtime.InteropServices;

命名空间MyDllLoadClass

{

公共课阅读器

{DllImport(" Cihaz.dll",CallingConvention = CallingConvention.Cdecl)]

static extern void SearchPort(uint Prm1);

[DllImport(" Cihaz.dll",CallingConvention = CallingConvention.Cdecl)]

static extern int CheckPort( uint Prm1);

[DllImport(" Cihaz.dll",CallingConvention = CallingConvention.Cdecl)]

static extern void SearchReader(uint Prm1,uint Prm2);

}


我正在尝试在我的其他课堂上使用它

label1.Text = Convert.ToString( MyDllLoadClass.Reader.CheckPort(i));



我认为Borland带来了删除Delphi.net - 如果是这样,那么保留你的鳕鱼会更好e base int delphi并将它们移动到
delphi.net?




不,它不会(遗憾的是,自版本以来,一个死硬的delphi粉丝说1)

对于商业用途来说太麻烦且不可行。 Borland这次发行了一件非常好的b $ b未完成的产品。

不要在Delphi上浪费你的便士,去c#。这2款产品现在非常类似于概念,对于那些能够选择b
的人来说,这是值得的。我看不到D存活的时间更长。

C#对你的简历来说也更好,目前在那里有大量的工作而且不是很多。对于Delphi来说很多很多。


Claire写道:

我认为Borland正在推出Delphi.net - 如果所以最好不要保留你的代码库int delphi并将它们移到delphi.net中吗?
不,它不会(遗憾的是,自版本以来,一个死硬的delphi粉丝1)
对于商业用途来说太麻烦且不可行。 Borland这次发布了一件非常完美的未完成产品。




我个人没试过D8,但我听说其他人这么说好吧。

出于好奇,您是否尝试过使用两个(IIRC)补丁的D8

?据说这使它更加稳定。

不要在Delphi上浪费你的便士,去c#。这两款产品现在的概念相似,对于那些能够挑选的人来说,这是值得的。我看不到D存活的时间更长。
C#对你的简历来说也更好,目前在那里有很多工作,对于Delphi来说并不是很多。



I am migrating my some applications from Delphi to C#. But...

Yes But I don''t know C# professionally. I am using DLL in delphi like this :

.....
const
RFID_103_485IO = ''Cihaz.dll'';

Function SearchPort (Prm1:LongWord) :LongWord; cdecl; External
RFID_103_485IO name ''SearchPort'';
Function CheckPort (Prm1:LongWord) :LongWord; cdecl; External
RFID_103_485IO name ''CheckPort'';
Function SearchReader (Prm1:LongWord; Prm2:LongWord) :LongWord; cdecl;
External RFID_103_485IO name ''SearchReader'';
Function CheckReader (Prm1:LongWord; Prm2:LongWord) :LongWord; cdecl;
External RFID_103_485IO name ''CheckReader'';

....

I am using it in Delphi :

.....
ResultNumber := CheckReader(n, m);

....

But how can I use my DLL functions in C#. I am trying below code in my
class. But it doesn''t work. Could you help me ?

using System;

using System.Runtime.InteropServices;

namespace MyDllLoadClass

{

public class Reader

{

[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]

static extern void SearchPort (uint Prm1);
[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]

static extern int CheckPort (uint Prm1);

[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]

static extern void SearchReader (uint Prm1, uint Prm2);

}

}

I am trying using this in my other class

label1.Text = Convert.ToString(MyDllLoadClass.Reader.CheckPort(i ));



解决方案

I thought Borland was bringing out Delphi.net -and if so wouldnt it be
better to retain your code base int delphi and move them across into
delphi.net?
--

--

Br,
Mark Broadbent
mcdba , mcse+i
=============
"Arda Han" <ar**@han.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...

I am migrating my some applications from Delphi to C#. But...

Yes But I don''t know C# professionally. I am using DLL in delphi like this :
....
const
RFID_103_485IO = ''Cihaz.dll'';

Function SearchPort (Prm1:LongWord) :LongWord; cdecl; External
RFID_103_485IO name ''SearchPort'';
Function CheckPort (Prm1:LongWord) :LongWord; cdecl; External
RFID_103_485IO name ''CheckPort'';
Function SearchReader (Prm1:LongWord; Prm2:LongWord) :LongWord; cdecl;
External RFID_103_485IO name ''SearchReader'';
Function CheckReader (Prm1:LongWord; Prm2:LongWord) :LongWord; cdecl;
External RFID_103_485IO name ''CheckReader'';

...

I am using it in Delphi :

....
ResultNumber := CheckReader(n, m);

...

But how can I use my DLL functions in C#. I am trying below code in my
class. But it doesn''t work. Could you help me ?

using System;

using System.Runtime.InteropServices;

namespace MyDllLoadClass

{

public class Reader

{

[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]

static extern void SearchPort (uint Prm1);
[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]

static extern int CheckPort (uint Prm1);

[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]

static extern void SearchReader (uint Prm1, uint Prm2);

}

}

I am trying using this in my other class

label1.Text = Convert.ToString(MyDllLoadClass.Reader.CheckPort(i ));



I thought Borland was bringing out Delphi.net -and if so wouldnt it be
better to retain your code base int delphi and move them across into
delphi.net?



No it wouldn''t (sadly said by a die hard delphi fan since version 1)
Its too buggy and unworkable for commercial use. Borland have issued a very
unfinished product this time.
Don''t waste your pennies on Delphi, go c#. The 2 products are now so
similar in concept it''s worth the move over for those people who are able to
pick and choose. I can''t see D surviving for much longer.
C# is better for your CV too, lots of jobs there at the moment and not so
many for Delphi.


Claire wrote:

I thought Borland was bringing out Delphi.net -and if so wouldnt it be
better to retain your code base int delphi and move them across into
delphi.net?
No it wouldn''t (sadly said by a die hard delphi fan since version 1)
Its too buggy and unworkable for commercial use. Borland have issued a very
unfinished product this time.



I haven''t tried D8, personally, but I''ve heard other people say this too.

Just out of curiosity, have you tried D8 with the two (IIRC) patches
applied? Allegedly this makes it much more stable.
Don''t waste your pennies on Delphi, go c#. The 2 products are now so
similar in concept it''s worth the move over for those people who are able to
pick and choose. I can''t see D surviving for much longer.
C# is better for your CV too, lots of jobs there at the moment and not so
many for Delphi.



这篇关于从Delphi迁移....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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