Re: [Mono-list] Deep Marshaling

2005-10-24 Thread Giuseppe Greco
Jon, sorry, there was just a typing error... here's the right code: ... public unsafe void FillMyStruct(string s) { // // convert the given string into a byte array // byte[] data = Encoding.UTF8.GetBytes(s); // // create another byte array for storing

Re: [Mono-list] Deep Marshaling

2005-10-23 Thread Giuseppe Greco
Jon, that you said is really interesting... and I'm wondering how can I solve another similar problem. Giving the following type: [StructLayout(LayoutKind.Sequential)] internal struct MyStruct { public int Id; public byte[] Data; // of course, that's wrong!!! } ... I'd like to

Re: [Mono-list] Deep Marshaling

2005-10-23 Thread Jonathan Pryor
On Sun, 2005-10-23 at 15:21 +0200, Giuseppe Greco wrote: Jon, that you said is really interesting... and I'm wondering how can I solve another similar problem. Giving the following type: [StructLayout(LayoutKind.Sequential)] internal struct MyStruct { public int Id; public

Re: [Mono-list] Deep Marshaling

2005-10-23 Thread Giuseppe Greco
Thanks Jon! Another alternative would be the following: [StructLayout(LayoutKind.Sequential)] internal struct MyStruct { public int Id; public unsafe byte* Data; } public unsafe void FillMyStruct(string s) { // // convert the given string into a byte array //

Re: [Mono-list] Deep Marshaling

2005-10-23 Thread Jonathan Pryor
On Sun, 2005-10-23 at 21:09 +0200, Giuseppe Greco wrote: Another alternative would be the following: [StructLayout(LayoutKind.Sequential)] internal struct MyStruct { public int Id; public unsafe byte* Data; } public unsafe void FillMyStruct(string s) { ...

Re: [Mono-list] Deep Marshaling

2005-10-21 Thread Jonathan Pryor
On Thu, 2005-10-20 at 16:07 -0700, Shankari wrote: While marshalling class and structure members, Mono doesnt do a deep marshal. If the structure has a string member, a default of charset.auto is set. Would you prefer some other default? But if the structure has an array of integers, what

[Mono-list] Deep Marshaling

2005-10-20 Thread Shankari
Hello, While marshalling class and structure members, Mono doesnt do a deep marshal. If the structure has a string member, a default of charset.auto is set. But if the structure has an array of integers, what would be done in that case? In general, if an array of simple types is a member of the