yes, that's what the link describes.  The open question is whether anyone has 
successfully done that with 15+ arguments?



________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Levente Uzonyi 
[[email protected]]
Sent: Tuesday, October 05, 2010 10:26 PM
To: [email protected]
Subject: Re: [Pharo-project] FFI number of arguments

On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:

> Hello all,
>
> I have been bumping into some functions with large numbers of arguments.  One 
> in particular would be best handled in the image if at all possible.  The 
> following might be the answer:
>
>   
> http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>
> Have any of you done this with >15 (or whatever the cutoff is) arguments?

You can create your own function object and invoke it with an array.
Here's an fprintf example on windows:

fprintf := ExternalLibraryFunction
        name: 'fprintf'
        module: 'msvcrt.dll'
        callType: ExternalFunction callTypeCDecl
        returnType: ExternalType signedLong
        argumentTypes: {
                (ExternalType structTypeNamed: #FILE) asPointerType.
                ExternalType string.
                ExternalType signedLong }.
file := Stdio default fopenWith: 'test.txt' with: 'w'.
fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
Stdio default fcloseWith: file.


Levente

P.S.: Note that you need the FILE and Stdio classes to run this example.

>
> Bill
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to