Dears. I have simple Delphi DLL like this
function GetConnection: PChar; stdcall; export;
begin
Result:= 'connection name is ....';
end;
exports
GetConnection;
and I am trying from C# as the folowing>
using System.Runtime.InteropServices;
namespace ConsoleApplication2
{
class Program
{
[DllImport("C:/Program Files (x86)/Borland/Delphi7/Projects/Project2.dll",
CallingConvention = CallingConvention.StdCall,
CharSet = CharSet.Unicode)]
public static extern string
GetConnection();
static void Main(string[] args)
{
string theresult = "";
theresult = GetConnection();
Console.Write(theresult);
Console.Write(" Press Enter plese:");
Console.ReadLine();
}
}
}
but I received error (ConsoleApplication2.vshost.exe' has exited with code 1073741855 (0x4000001f))
thanks in advance
User contributions licensed under CC BY-SA 3.0