S
Steve
I'm trying to call some unmanaged methods from a DLL. I did this awhile
ago, a couple years ago... I'm a little rusty. I will show you what I'm
dealing with:
<unmanaged function signature>
STATUS_T WINAPI MSP430_Initialize(CHAR* port, LONG* version);
</unmanaged function signature>
STATUS_T is a long (typedef long STATUS_T)
CHAR is a char (winnt.h)
LONG is a long(winnt.h)
Here is my c# signature:
<c# signature>
[DllImport("MSP430.dll")]
static extern long MSP430_Initialize(string port, out long version);
</c# signature>
This doesn't crash (it did before I added the 'out' keyword) but it also
doesn't return a valid value. If I make the same call from a unmanaged c
app I get a return result of: 0
In my c# app I get: 8589934592
I'm not seeing the problem. I know PInvoke can be a tricky bastard... but
this seems pretty straightforward. Anyone have any ideas for me?
Thanks for reading,
Steve
ago, a couple years ago... I'm a little rusty. I will show you what I'm
dealing with:
<unmanaged function signature>
STATUS_T WINAPI MSP430_Initialize(CHAR* port, LONG* version);
</unmanaged function signature>
STATUS_T is a long (typedef long STATUS_T)
CHAR is a char (winnt.h)
LONG is a long(winnt.h)
Here is my c# signature:
<c# signature>
[DllImport("MSP430.dll")]
static extern long MSP430_Initialize(string port, out long version);
</c# signature>
This doesn't crash (it did before I added the 'out' keyword) but it also
doesn't return a valid value. If I make the same call from a unmanaged c
app I get a return result of: 0
In my c# app I get: 8589934592
I'm not seeing the problem. I know PInvoke can be a tricky bastard... but
this seems pretty straightforward. Anyone have any ideas for me?
Thanks for reading,
Steve