1

Topic: DLL from Visual C# in Delphi 2010

Friends, prompt as it is possible to use in Delphi 2010 dll, written in Visual C# 2010? And whether generally it is possible. I tried the elementary. At pushing the button, in the field  the text which I transferred in library should boot.  simply accepts a line and returns it. I give Kod Delfi of the project with the form, the button and a field  more low. Even more low the code  written in C#. And even more low the code , written in . One works, another is not present.
The code  the project:

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms;
Dialogs, IdTCPConnection, IdTCPClient, IdHTTP, IdBaseComponent, IdComponent;
IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL;
StdCtrls;
type
TForm1 = class (TForm)
IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;
IdHTTP1: TIdHTTP;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click (Sender: TObject);
private
{Private declarations}
public
{Public declarations}
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//Function from 
function getText (_s: string): string; stdcall; external ' GetInnerText.dll ';
procedure TForm1.Button1Click (Sender: TObject);
begin
//I transfer there the text which it returns reversely
memo1.Text: = getText ('  ');
end;
end.

Code , written in Visual C# 2010:

using System;
using System. Collections. Generic;
using System. Linq;
using System. Text;
public class GetInnerText
{
public static string getText (string _s)
{
return _s;
}
}

What do I do not so?
, written in most  works. Here its code:

library GetInnerText;
uses
SysUtils;
Classes;
Forms;
{$R *.RES}
function getText (_s: string): string; stdcall; export;
begin
result: = _s;
end;
exports getText;
begin
end.

2

Re: DLL from Visual C# in Delphi 2010

Edw1993;
Anyway, it is impossible to exchange lines: the line Delphi is "purely  concept" and it is not necessary for an exchange  between different systems. Try to use PWideChar.
Further, to use "controlled " from "uncontrollable" applications, it is necessary to fulfill the correct export of methods. One of simple methods: https://sites.google.com/site/robertgie … gedexports

3

Re: DLL from Visual C# in Delphi 2010

Edw1993;
Yes it is necessary to do the table of export.
Here the utility which I wrote for this purpose
https://yadi.sk/d/E1x2KDeLjniVB

4

Re: DLL from Visual C# in Delphi 2010

Whether and there are still methods of a call of managed code from dll, except creation COM of servers?