tStringList passing in C# to Delphi DLL -


i have delphi dll function defined as:

function submitjobstringlist(joblist: tstringlist; var jobno: integer): integer;

i calling c#. how declare first parameter tstringlist not exist in c#. have declaration as:

[dllimport("opt7bja.dll", charset = charset.ansi, callingconvention = callingconvention.stdcall)] public static extern int submitjobstringlist(string[] tstringlist, ref int jobno); 

but when call memory access violation exception.

anyone know how pass tstringlist correctly c#?

you'll not have luck this. tstringlist more array, it's full-blown class, , exact implementation details may differ possible .net. take @ delphi vcl source code (that is, if have it) , try find out if can rebuild class in c#, , pass of best friend, interop marshaller. note delphi string type different .net string type, , passing without telling marshaller should do, pass char-array, likely.

other that, suggest changing delphi dll. it's never thing expose delphi-specific in dll used non-delphi clients. make parameter array of pchar , should fine.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -