[gambit-list] calling scheme from C
    Marc Feeley 
    feeley at iro.umontreal.ca
       
    Sun Jun 14 10:29:36 EDT 2009
    
    
  
On 13-Jun-09, at 6:05 PM, Bradley Lucier wrote:
> On Sat, 2009-06-13 at 07:31 -0400, Marc Feeley wrote:
>>
>>    % gsc -link scmlib.scm
>>    % gcc main-c-app.c -D___LIBRARY scmlib.c scmlib_.c -lgambc
>>    % ./a.out
>>    hello montreal
>>    returned 8
>>    hello world
>>    returned 5
>> */
>
>
> Marc:
>
> Once again examples of mixing C and Scheme code on this list contain
> incorrect gcc compiler options.  You will quite possibly get incorrect
> results in the executable if you don't include -fwrapv,
> -fno-strict-aliasing, -mieee (on x86), etc., etc., all those options
> that you work so hard to get right in gsc-cc-o.bat.
>
> I recommend that you put together shell-scripts:
>
> gsc-compile-c-to-o
> gsc-link-c-to-scheme
>
> that will have the correct options.
>
> This is bug 103.
>
> Brad
Thanks for the suggestion. The problem is that there are so many  
different ways that the C code generated by gsc can be used (creating  
a .o file, creating an executable, creating a plugin, etc). Depending  
on the case you may want some unusual C compiler options, like  
selecting the calling convention, position independent code,  
profiling, etc.
So it doesn't seem like the right solution to package all of these  
decisions in a single script.
What is the right abstraction?
Marc
    
    
More information about the Gambit-list
mailing list