This is a little different than the other DllImport problems I've seen.
I'm calling a DLL from C# and it works great when I run inside Visual
Studio .NET.
But when I try to run my application from the same .EXE file that the
project creates, I get
"NullReferenceException: Object reference not set to an instance of an
object."
Below is my DllImport statement which seems to marshal just fine when
I run inside Visual Studio .NET. Any help greatly appreciated. - Jeff
[DllImport("xsb.dll", EntryPoint = "_xsb_init_string@4")]
private static extern Int32 xsb_init_string (String opts);
<jeff@thefirst.org> wrote in message
> Below is my DllImport statement which seems to marshal just fine when
> I run inside Visual Studio .NET. Any help greatly appreciated. - Jeff
>
> [DllImport("xsb.dll", EntryPoint = "_xsb_init_string@4")]
> private static extern Int32 xsb_init_string (String opts);
I don't know if it will work, but try specifying the CharSet field of the
DllImport attribute, and perhaps also the MarshalAs attribute. You'll get
something like this:
[DllImport("xsb.dll", EntryPoint = "_xsb_init_string@4", CharSet =
CharSet.Ansi)]
private static extern Int32 xsb_init_string
([MarshalAs(UnmanagedType.LPStr)] String opts);
Regards,
Pieter Philippaerts