LocalAlloc

  • Thread starter Thread starter Dirk Reske
  • Start date Start date
D

Dirk Reske

Hello,

I have following C++ code:
the Memory should be larger than the struct

STRUCT struct1 = (STRUCT) LocalAlloc(LPTR, 100);

how can I perform this in C#
I want this, because I need to call a C++ dll
 
Dirk Reske said:
Hello,

I have following C++ code:
the Memory should be larger than the struct

STRUCT struct1 = (STRUCT) LocalAlloc(LPTR, 100);

how can I perform this in C#
I want this, because I need to call a C++ dll

Well, without seeing the structure, I'd probably say add a byte[] at the end
of the structure with a MarshalAs(UnmanagedType.ByValArray,SizeConst=100)
attribute applied to that field.
 
Back
Top