Re: Problem with Marshal.SizeOf in CF 2.0



What's your definition of LINECALLPARAMS? It likely has an embedded
pointer, which is causing the marshaler grief.

-Chris


"Per Rasmussen" <p> wrote in message
news:OJrMnkBeGHA.2068@xxxxxxxxxxxxxxxxxxxxxxx
When I execute these two lines in CF 2.0:

Type t1 = typeof(LINECALLPARAMS);
int a1 = Marshal.SizeOf(t1);

I get a NotSupportedException on the second line. According to the docs it
should not even be able to throw this exception. Here is a stacktrace:

ved System.Runtime.InteropServices.Marshal.SizeOfInternal()
ved System.Runtime.InteropServices.Marshal.SizeOf()
ved System.Runtime.InteropServices.Marshal.SizeOf()
...

"ved" means at (in danish).

Can anybody help me out?

Thanks in advance,
Per Rasmussen.




.



Relevant Pages

  • Re: Memory Structure Pointer Problems
    ... typedef struct sta { ... char* name; ... int num_cmpnds; ... A pointer to a struct cmp is almost ...
    (comp.lang.c)
  • Re: C# - getting binary data from .lib
    ... Use Marshal.AllocHGlobal to allocate the memory and pass this IntPtr to the ... int retCode = create(id, scale, ptrImage); ... You now control the pointer returned. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Another spinoza challenge
    ... You should test against the int type's limits: ... typedef struct complex ... a pointer to an integer ... A macro is preferable because it is replaced by inline code, ...
    (comp.lang.c)
  • Re: C# - getting binary data from .lib
    ... int create(int id, int scale, unsigned char *image); ... unsigned char* ptrImage = NULL; ... // Read through entire pointer byte by byte and put into managed array ...
    (microsoft.public.dotnet.framework.interop)
  • Re: C# - getting binary data from .lib
    ... then there is a problem with the ptrImage ... int retCode = create(id, scale, ptrImage); ... You now control the pointer returned. ...
    (microsoft.public.dotnet.framework.interop)