[gambit-list] calling scheme from C

Bradley Lucier lucier at math.purdue.edu
Sun Jun 14 23:58:06 EDT 2009


On Jun 14, 2009, at 11:32 PM, Adrien Piérard wrote:

>
>> So it doesn't seem like the right solution to package all of these
>> decisions in a single script.
>>
>> What is the right abstraction?
>
> I guess that the right abstraction is
> - conservative: it always works
> - end user-oriented: it should work out of the box for those who know
> nothing and don't want to know more. A few others will tweak it
> manually. Most people do *not* need unusual (sic) compiler options, or
> to select the calling convention.

For some reason I didn't get Marc's reply (I see it on the list  
archive, though).

Anyone building applications or dynamically-loadable libraries, or  
calling scheme from C, or ... will have to know *something* beyond

gsc file
gsi file

Perhaps the following flags from the makefiles could be exported  
somehow (have a script that a user can run (in their .bashrc  
or .cshrc file?) that will add them to one's environment, as  
GSC_FLAGS_OBJ or something), or perhaps they could just be used in  
the examples on this list or in the documentation as symbolic variables.

On my PowerPC Mac I have:

FLAGS_OBJ =   -no-cpp-precomp -Wall -W -Wno-unused -O1 -fno-math- 
errno -fschedule-insns2 -O1 -fno-math-errno -fschedule-insns2 -fno- 
trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC  
-fno-common
FLAGS_DYN =    -no-cpp-precomp -Wall -W -Wno-unused -O1 -fno-math- 
errno -fschedule-insns2 -O1 -fno-math-errno -fschedule-insns2 -fno- 
trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC  
-fno-common -bundle -flat_namespace -undefined suppress
FLAGS_LIB =    -dynamiclib -flat_namespace -undefined suppress
FLAGS_EXE =
DEFS = -DHAVE_CONFIG_H
LIBS =

On my Linux box I have

FLAGS_OBJ =    -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno- 
trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fno- 
move-loop-invariants -fPIC -fno-common -mieee-fp
FLAGS_DYN =     -Wno-unused -O1 -fno-math-errno -fschedule-insns2 - 
fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer - 
fno-move-loop-invariants -fPIC -fno-common -mieee-fp   -rdynamic -shared
FLAGS_LIB =      -rdynamic -shared
FLAGS_EXE =    -rdynamic
DEFS = -DHAVE_CONFIG_H
LIBS = -lutil -ldl -lm

Quite a few of these are required either for correctness of the  
compiled code (-fno-math-errno -fno-trapping-math -fno-strict- 
aliasing -fwrapv -mieee-fp -fPIC), speed of the compiled code (-O1 - 
fschedule-insns2  -fomit-frame-pointer), runtime of gcc when  
compiling Gambit-generated code (-fno-move-loop-invariants) or for  
other reasons that I'm not sure about.

So, perhaps this isn't a bad idea.  These options vary from OS to OS,  
they're chosen at configure time, perhaps there should be a standard  
way that a Gambit user can access them.

Brad


More information about the Gambit-list mailing list