469,927 Members | 1,329 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Marshaling complex structs from C# to managed C++ wrapper

I have written a managed C++ wrapper class around an old
C++ DLL that I have to use in my application. My problem
is I need to marshal a bunch of structures from C# to the
C++ class. These structuers contain mostly StringBuilder
objects, but some contain arrays of other structs that
themselves contain StringBuilder objects.

I have defined the stucts in the C++ header file as
typedef __gc StructName
{
StringBuilder *hmm;
....
}

Passing these back and forth works great. I make a change
to the structs in the C++ class, and it gets back to the
C# class just fine.

Now, how do I define a struct that contains an array of
other structs? Also, how do I instantiate it correctly
and how do I work with it on the C++ side? Can I do a
memcpy?

Any help would be greatly appreciated.

Regards,

Arthur Autenzio
ar*************@bostonstock.com

Nov 15 '05 #1
0 1162

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by C. N. Sridhar | last post: by
5 posts views Thread by VM | last post: by
1 post views Thread by Nadav | last post: by
1 post views Thread by Chua Wen Ching | last post: by
4 posts views Thread by MSDousti | last post: by
8 posts views Thread by Mas L via DotNetMonster.com | last post: by
1 post views Thread by Lee Crabtree | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.