-
August 31st, 2004, 10:18 AM
#1
Unmanaged struct
I am getting the following compile error:
E:\Computer Work\C#\Projects\SharpVorbis\Class1.cs(103): Cannot take the address or size of a variable of a managed type ('SharpVorbis.Ogg_H.oggpack_buffer')
Add line 103 is:
public static extern void oggpack_writetrunc(oggpack_buffer *b, long bits);
The definition of oggpack_buffer is:
unsafe struct oggpack_buffer
{
long endbyte;
int endbit;
string buffer;
string ptr;
long storage;
}
(The unsafe is there because i was trying to make it unmanaged
-
August 31st, 2004, 05:19 PM
#2
Re: Unmanaged struct
public static extern void oggpack_writetrunc(oggpack_buffer *b, long bits);
if you know the size here you can allocate size and then get value,
otherwise use ref keyword
like
public static extern void oggpack_writetrunc(ref oggpack_buffer b, long bits);
regards
Paresh.
- Software Architect
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|