exporting function with parm pointer to char string
From: Angel (none)
Date: 03/02/04
- Next message: Allen Anderson: "Re: System.IO.FileSystemWatcher done creating event not exist"
- Previous message: Paul Steele: "How to authenticate user credentials?"
- Next in thread: Mattias Sjögren: "Re: exporting function with parm pointer to char string"
- Reply: Mattias Sjögren: "Re: exporting function with parm pointer to char string"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 2 Mar 2004 18:25:24 -0400
I'm exporting a C-style function call with this syntax:
int getDate(char *date);
I'm trying to export to my c# app like this:
[DllImport("C:\\zm7\\Developm\\DLL\\W32.DLL")]
public static extern int getDate(System.IntPtr ptr);
public void getDate()
{
IntPtr ptr = new IntPtr();
string str = "";
getDate(ptr); //// ERROR: Object reference not set to an instance of
an object
str = Marshal.PtrToStringAnsi(ptr);
}
What Am I doing wrong?
Thanks.
- Next message: Allen Anderson: "Re: System.IO.FileSystemWatcher done creating event not exist"
- Previous message: Paul Steele: "How to authenticate user credentials?"
- Next in thread: Mattias Sjögren: "Re: exporting function with parm pointer to char string"
- Reply: Mattias Sjögren: "Re: exporting function with parm pointer to char string"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|