[sac-user] sac2c -genlib c

Stephan Herhut sah at sac-home.org
Fri Apr 29 18:28:24 BST 2011

Dear Heinz,

it seems the documentation is outdated. The genlib feature has been
replaced by a new, external tool called sac4c. The workflow is the

1. Create a SAC module (.sac file)
2. Compile that module (.a and two .so files)
3. Call sac4c on the SAC module (generates another .so file and a header file)
4. Compile your c program
5. Link everything
6. Run

sac4c -h should provide some help on using sac4c. I will try dig up an
example when I am back home later today.

Regarding the mystery behind different library sizes: When compiling a
library with the -mt option, the compiler generates 3 versions of each
function: One for sequential execution, one that switches to parallel
mode where possible and one that runs sequentially when already inside
of a parallel section. These three versions ensure composability
across module boundaries in the mt case.

I hope this helps,

On Fri, Apr 29, 2011 at 9:23 AM, Heinz Hertlein <H.Hertlein at bioid.com> wrote:
> Dear SAC experts,
> I would like to experiment with the feature of implementing some function
> in SAC and calling this function from C, for possibly extending the biometric
> optimization use case.
> I wrote a small example SAC module and tried to compile it with the "-genlib c"
> option.  "sac2c -h" says that this would generate c object and header files,
> however, the kind of files produced do not change
> (lib<MyModule>Mod.a, lib<MyModule>Mod.so and lib<MyModule>Tree.so).
> Don't know whether this has anything to do with it, but I experimented with
> the -mt option as I have read that it is not supported for C libraries,
> and made the following, puzzling observation.  I am giving the command
> lines and the size in bytes of "libMyModuleMod.a" as follows
> (the output of sac2c seems to depend on files that are already present):
> sac2c -genlib c myModule.sac
> --> 13210
> sac2c -genlib c -mt myModule.sac
> --> 35976
> sac2c -genlib c myModule.sac
> --> 33620
> rm lib*
> sac2c -genlib c myModule.sac
> --> 13210
> rm lib*
> sac2c myModule.sac
> --> 13210
> Thanks for your advice!
> Best regards - and a nice week-end,
> Heinz
> _______________________________________________
> sac-user mailing list
> sac-user at sac-home.org
> http://lists.sac-home.org/mailman/listinfo.cgi/sac-user

Dr Stephan Herhut
Centre for Computer Science and Informatics Research
Science and Technology Research Institute
University of Hertfordshire

More information about the sac-user mailing list