I think its a fairly simple question.. I'm just not that experienced in Managed code yet...
 
The question is, How do you allocate a block of memory in Managed code (Managed VC++ DLL) and pass the pointer over to an unmanaged DLL (Written in VC++ 7.1)  so that this memory block can be filled with data. 
 
I've tried using:  (Managed VC++ DLL)
 
    UBYTE __pin *pDataPtr = NULL;
    pDataPtr = (UBYTE *)new char[dwDataSize];
 
But that doesn't work.. It compiles, But when you call the function in VB.Net it fails with this error:
 
    An unhandled exception of type 'System.NullReferenceException' occurred in cdmsclientdotnet.dll
    Additional information: Object reference not set to an instance of an object.
 
This is where I'm stuck! Any ideas? 
 
My guess here is because of Manage code and the Garbage Collector, You don't really get a "real" memory pointer, when calling new, But more of a handle.  But how do I get the real memory pointer to pass to unmanaged code?
 
 


 
 
----- Original Message -----
Sent: Tuesday, December 28, 2004 1:42 PM
Subject: RE: [msvc] .Net (Managed VC++)

I'm personally no expert, but why not ask your question to see if anyone can help?


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Weston Fryatt
Sent: 2004/12/28 08:06 ب.ظ
To: MSVC
Subject: [msvc] .Net (Managed VC++)

Anyone an expert in here that can help me solve a problem?


_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to