How do I: Marshal - Native String Data to Managed Code

R

Russell Mangel

Hi,
I am using VS2003 MC++ & IJW (Mixed DLL)

The Question:
How do I most effciently I transfer large numbers of string data created in
native code to managed code?

The Routine:
I would like to call my native C++ method which will create a large number
of strings,
and then return this string data to Managed Code in one operation.

We can use pretty much any data structure on the native side, and the
managed side, for the contatining the string data.
The string data is being created on the native side by MAPI, the string type
is: lpszA (Ansi String).

Thanks
Russell Mangel
Las Vegas, NV
 
G

Gary Chang

Hi Russell,
How do I most effciently I transfer large numbers of string data created in native code to managed code?

I suggest you can transfer the large string via a simple byte array which
can be easily processed by the both side.

The other recommended method may be using the Marshal.AllocHGlobal to
allocate the memory for that big string...


Just an advice!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
R

Russell Mangel

I think I get your idea:
Use a blittable data type, like a binary byte array. I can easily convert
the binary array to a String on the managed side.

This might be a perfect answer, because the data on the native side, can be
saved as a binary byte array, instead of a string.
The actual native data is a MAPI EntryID, which can be saved as either ansi
PT_STRING, or PT_BINARY.

Thanks for your idea.

Russell Mangel
Las Vegas, NV
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top