Levente, What problem do you have with asking whether someone else has already tried it? Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print? ________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Levente Uzonyi [leves@elte.hu] Sent: Tuesday, October 05, 2010 11:09 PM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] FFI number of arguments On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
yes, that's what the link describes. The open question is whether anyone has successfully done that with 15+ arguments?
It works up to 128 arguments. But why don't you try it yourself? Levente
________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Levente Uzonyi [leves@elte.hu] Sent: Tuesday, October 05, 2010 10:26 PM To: Pharo-project@lists.gforge.inria.fr 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...
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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project