SiamIT
Well-known member
- Joined
- Aug 3, 2021
- Messages
- 53
- Programming Experience
- 5-10
Greetings,
I am trying to using a Delphi dll in c# program..
here is the Delphi library code:
the generated dll file is "UnicodeToBijoy.dll"
and here is the c# code
but when i execute the code, it throws following error
any solution please?
thanks in advance
best regards
I am trying to using a Delphi dll in c# program..
here is the Delphi library code:
C#:
library UnicodeToBijoy;
uses
System.SysUtils,
System.Classes,
BanglaChars in 'BanglaChars.pas',
clsUnicodeToBijoy2000 in 'clsUnicodeToBijoy2000.pas';
{$R *.res}
var
baseClass : TUnicodeToBijoy2000;
function Uni2Bijoy(Const UniText: String): String; stdcall;
begin
Result := baseClass.Convert(UniText);
end;
exports
Uni2Bijoy;
begin
end.
the generated dll file is "UnicodeToBijoy.dll"
and here is the c# code
C#:
[DllImport(@"f:\Temp\NW\UnicodeToBijoy.dll")]
public static extern string Uni2Bijoy(
string UniText
);
private void Uni2BijoyButton_Click(object sender, EventArgs e)
{
string t = Uni2Bijoy("LoveYou");
}
but when i execute the code, it throws following error
C#:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
any solution please?
thanks in advance
best regards