在C#中调用DLL

Delphi:

library mydll; uses sysutils, classes; {$r *.res} function out_char(str1:pchar;str2:pchar):pchar;stdcall; var temp:pchar; begin getmem(temp,length(str1)+length(str2)+1); strcopy(temp,str1); strcat(temp,str2); result := temp; end; exports out_char; begin end.

C#:

using System.Runtime.InteropServices; [DllImport("mydll.dll")] public static extern string out_char(string str, string str2);

你可能感兴趣的:(在C#中调用DLL)