Try using
Marshal.StringToHGlobalAnsi[
^]
to convert managed string to unmanaged string (returns
IntPtr
pointing to converted string).
Then change import declaration to use IntPtr:
[DllImport("abc.dll")] private static extern long CreateLink(IntPtr lpszPathObj, string lpszPathLink, IntPtr lpszDesc);
I'm not sure if 2nd param should also be converted.
There is article here that might help:
Creating and Resolving shell links[
^]
There is also an iterop here, no need for C++ dll:
http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp[
^]