PInvoke, how to marshal a UINT*

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi people

I have a library built using MSVC6 which exports a method with the following signature

void library_method( UINT* sw_mode )

I am trying to use PInvoke to be able to call it from my C# project, but I cannot find a suitable marshal type

Is there a type that I can use to marshal a UINT*? If not, are there any other integrated solutions to this problem

Thank you
Tom.
 
One of these

void library_method(ref uint sw_mode)
void library_method(out uint sw_mode)
void library_method(uint[] sw_mode)

depending on the parameter direction and whether it represents a
single integer or an array. You could also replace uint with int if
you prefer that for some reason.



Mattias
 
Hi Mattias,

----- Mattias Sjögren wrote: ----
One of thes

void library_method(ref uint sw_mode
void library_method(out uint sw_mode
void library_method(uint[] sw_mode

depending on the parameter direction and whether it represents
single integer or an array. You could also replace uint with int i
you prefer that for some reason
--
Mattias Sjögren [MVP] mattias @ mvps.or
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.co

Thank you very much, that is what I need.

I read something similar, but I got confused with the InAttribute and OutAttribute. As a matter of fact, I'm still confused about these attributes. Are they equivalent to C# out, ref? Or can I only mimic pointers using C# out/ref

Thanks again
Tom T
 

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