Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 10-02-2006, 06:59 PM
luvcloud_say luvcloud_say is offline
Junior Member
 
Join Date: Jun 2005
Posts: 10
Default How to call C# dll from Delphi

Hi,
Does anyone know how to call a C# dll from Delphi? Thanks!
Reply With Quote
  #2  
Old 10-02-2006, 11:13 PM
autocorect autocorect is offline
Senior Member
 
Join Date: Mar 2005
Posts: 725
Default RE: How to call C# dll from Delphi

It's not important if the Dll it's compiled with C#, C++, or else if Dll it's for win32 and apllication it's for win32.

demo to call a DLL.

Code:
unit main;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, Registry;

type
  TForm1 = class(TForm)
    BitBtn1: TBitBtn;
    Label1: TLabel;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

function RestoreAdress:pchar ; stdcall; external 'Adress.DLL' ;


procedure TForm1.BitBtn1Click(Sender: TObject);
begin

// call function from your dll
Label1.Caption:=PChar(RestoreAdress) ; 

end;

end.
Reply With Quote
  #3  
Old 06-09-2008, 04:40 AM
ZarrinPour ZarrinPour is offline
Senior Member
 
Join Date: Jul 2003
Posts: 232
Default RE: How to call C# dll from Delphi

Hi autocorect
I have the sam problem BUT in reverse mode . i have already written a DLL in delhi BUT i don't know how to call it from C# , Could you please show me how i should do that.?

Any help greatly would be appreciated.
Kind Regards.
Reply With Quote
  #4  
Old 06-09-2008, 04:42 AM
ZarrinPour ZarrinPour is offline
Senior Member
 
Join Date: Jul 2003
Posts: 232
Default RE: How to call C# dll from Delphi

Hi again
I just forgot to paste my DLL function source here:

Code:
library MyDll;

uses

  ShareMem,
  ExceptionLog,
  SysUtils,
  Classes,
  Dialogs,
  StrUtils;

function GETREVERSESTRING(pStr:PChar):PChar;
var
  TmpStr:string;
begin
  TmpStr:=pStr;
  Result:=PCHar(ReverseString(TmpStr));
end;

exports GETREVERSESTRING;


begin
end.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:55 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.