By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,975 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,975 IT Pros & Developers. It's quick & easy.

PInvoke, how to marshal a UINT*

P: n/a
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.
Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #2

P: n/a
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

Nov 16 '05 #3

P: n/a
Are they equivalent to C# out, ref?
No, but out implies OutAttribute, so

out == [Out] ref

Or can I only mimic pointers using C# out/ref?


You can also use "real" pointers in unsafe code.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #4

P: n/a
Thank you,
---
Tom Tempelaere

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.