Hi,

So, I suggest this solution: https://github.com/pharo-project/pharo/pull/750

It is a plugin for the OpalCompiler that can be activated with the command 
"FFICompilerPlugin install."
The plugin is pragma-based to detect the methods where the arguments names 
should be remembered.
The pragma should be added in the FFI API methods, i.e., the methods that are 
called by the FFI methods where the arguments have to be remembered.
Example:

This FFI method should remember the name of the argument named "config":

repository_config: config
        ^ self
                call: #(#LGitReturnCodeEnum #git_repository_config 
#(#LGitConfig #* #config #, #self))
                options: #()

So, the FFI function should wear the pragma <ffiCalloutTranslator>:

call: fnSpec options: options
        <ffiCalloutTranslator>
        ^ (self safeFFICalloutIn: thisContext sender)
                cdecl;
                options: options;
                function: fnSpec module: self ffiLibraryName

To remove to be able to remove the sources (.changes and .sources), you only 
have to activate the plugin, no recompilation is necessary. You can even import 
new FFI methods or change the FFI API.

N.B: Users that redefine the FFI API (like TLGitCalloutTrait >> call:options:) 
also have to wear the pragma.

Cheers,
Vincent

-----Original Message-----
From: Pharo-dev [mailto:[email protected]] On Behalf Of 
Stephane Ducasse
Sent: Wednesday, January 24, 2018 9:21
To: Pharo Development List <[email protected]>
Subject: Re: [Pharo-dev] FFI without the Pharo sources

So if you implement a cool solution we will integrate it immediately :)

On Wed, Jan 24, 2018 at 6:20 PM, Stephane Ducasse <[email protected]> 
wrote:
> Thanks Vincent we are interested to make the independence on source 
> much simpler.
>
> Stef
>
>
> On Wed, Jan 24, 2018 at 5:09 PM, Eliot Miranda <[email protected]> 
> wrote:
>> Hi Vincent,
>>
>>> On Jan 23, 2018, at 4:54 PM, <[email protected]> 
>>> <[email protected]> wrote:
>>>
>>> Hi,
>>>
>>> I am working to be able to create some standalone apps in Pharo. And for 
>>> this, I would like to remove of the .sources and .changes. But, by removing 
>>> them, the args names are reset to arg1, arg2, arg3, ... and the FFI cannot 
>>> be used anymore.
>>>
>>> Does someone (Esteban?) have a solution that I could implement to fix this 
>>> issue?
>>
>> One avenue that should be easy to implement would be to modify the compiler 
>> to save the temporary names as a property of the method.
>>
>>
>>>
>>> Thanks!
>>>
>>> Vincent
>>
>> _,,,^..^,,,_ (phone)

Reply via email to