[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]pInvoke params problem
From: |
Chris Smith |
Subject: |
Re: [DotGNU]pInvoke params problem |
Date: |
Tue, 8 Oct 2002 10:35:14 +0100 |
On Tuesday 08 October 2002 00:03, Rhys Weatherley wrote:
> Chris Smith wrote:
> > On Sunday 06 October 2002 06:31, Gopal V wrote:
> > > With XSharp to refer, I think PInvoke has been tortured enough .
> > > GW Api cannot not prove to be more troublesome ;-)
> >
> > Okay, What's the matter with the attached code then?
>
> I think I see the problem. I'll assume that you are running
> this on a 32-bit system like an i386.
>
> In C, both "long" and "int" are 32 bits in size.
> In C#, "long" is 64 bits and "int" is 32 bits. This causes
> a mismatch when the PInvoke marshalling is performed. You
> should instead use this:
Ack!
I knew this, but didn't spot the marshalling problems PInvoke would encounter.
Sigh. At least it's etched on my brain now!
> > Parsing PNative.cs
> > Parsing PTest.cs
> > PNative.cs:9: `DllImportAttribute' is not declared in the current scope
>
> This one's easy. You misspelt "InteropServices" in PNative.cs.
> The "int" error will go away when you fix this.
>
> You will also get an error for "DllImportMapAttribute". That
> is because you need to declare "DllImportMap" yourself as it
> isn't a standard class, but a pnet hack for doing library
> renaming. In your example, you don't need it at all so you
> can leave it out.
This was just me hacking about randomly, without really knowing what I was
doing, trying to resolve the marshalling problem.
You're right, I won't need it.
Cheers Rhys.
Chris
--
Chris Smith
Technical Architect - netFluid Technology Ltd.
"Internet Technologies, Distributed Systems and Tuxedo Consultancy"
E: address@hidden W: http://www.nfluid.co.uk
- Re: [DotGNU]To run ./hello.exe, (continued)
- Re: [DotGNU]To run ./hello.exe, Rhys Weatherley, 2002/10/09
- Re: [DotGNU]To run ./hello.exe, Chris Smith, 2002/10/10
- Re: [DotGNU]To run ./hello.exe, Chris Smith, 2002/10/10
- [DotGNU]pInvoke params problem, Chris Smith, 2002/10/07
- [DotGNU]Re: pInvoke params problem, Chris Smith, 2002/10/07
- Re: [DotGNU]pInvoke params problem, Chris Smith, 2002/10/07
- Re: [DotGNU]pInvoke params problem, Rhys Weatherley, 2002/10/07
- Re: [DotGNU]pInvoke params problem,
Chris Smith <=