[Pharo-project] FFI number of arguments

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Wed Oct 6 02:41:57 EDT 2010


In Smallapack, I implemented a hack to handle methods with 15+
arguments, including regular Smalltalk + FFI (you can figure that
Smalltalk methods wrapping a FFI call sometimes need 15+ parameters
too)..
It is rooted at http://bugs.squeak.org/view.php?id=2918
A more recent version can be found at
http://www.squeaksource.com/Smallapack/Compiler-nice.150.mcz
It might be non trivial to merge with Pharo, but you can give it a try.

Nicolas

2010/10/6 Levente Uzonyi <leves at elte.hu>:
> 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 at lists.gforge.inria.fr
>> [pharo-project-bounces at lists.gforge.inria.fr] On Behalf Of Levente Uzonyi
>> [leves at elte.hu]
>> Sent: Tuesday, October 05, 2010 10:26 PM
>> To: Pharo-project at 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=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
>>> Pharo-project at lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>




More information about the Pharo-dev mailing list