dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]pInvoke params problem


From: Chris Smith
Subject: [DotGNU]pInvoke params problem
Date: Mon, 7 Oct 2002 17:10:37 +0100

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've a C function that looks like this:

   void
   test_params( long level, const char *str, int len )
   {
     printf( "Level: %ld   Str: %p   Level: %d\n", level, str, len );
   }


I export it as:

   [DllImport("libexample")]
   extern public static void test_params( long level, String msg, int len );


Call it like this:

   Goldwater.Native.test_params( level, msg, msg.Length );
   OR
   Goldwater.Native.test_params( 100, "Hello", 5 );


And I get this output:

   Level: 63   Str: (nil)   Level: 135765976


Hmm.
I'm building with the latest tarball (not CVS) release of cscc.


The attached code has a 'build' script to get things working.
This is a simple example extracted from the more complicated wrapper suite 
I'm trying to construct... that one's worse as it core dumps!!


Cheers.
Chris

-- 
Chris Smith
  Technical Architect - netFluid Technology Ltd.
  "Internet Technologies, Distributed Systems and Tuxedo Consultancy"
  E: address@hidden  W: http://www.nfluid.co.uk


reply via email to

[Prev in Thread] Current Thread [Next in Thread]