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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top