<p>I have a Delphi DLL with a function defined as:</p>

<p>function SubmitJobStringList(joblist: tStringList; var jobno: Integer): Integer;</p>

<p>I am calling this from C#. How do I declare the first parameter as a tStringList does not exist in C#. I currently have the declaration as:</p>

<pre><code>[DllImport("opt7bja.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern int SubmitJobStringList(string[] tStringList, ref int jobno);
</code></pre>

<p>But when I call it I get a memory access violation exception.</p>

<p>Anyone know how to pass to a tStringList correctly from C#?</p>

You'll most likely not have any luck with this. The TStringList is more than just an array, it's a full-blown class, and the exact implementation details may differ from what is possible with .NET. Take a look at the Delphi VCL source code (that is, if you have it) and try to find out if you can rebuild the class in C#, and pass it with the help of your best friend, the Interop Marshaller. Note that even the Delphi string type is different from the .NET string type, and passing it without telling the marshaller what he should do, he will pass it as a char-array, most likely.
Other than that, I would suggest changing the Delphi DLL. It's never a good thing to expose anything Delphi-specific in a DLL that is to be used by non-Delphi clients. Make the parameter an array of PChar and you should be fine.