[gambit-list] Link loadable library to Scheme file

Thomas Hage thomas.hage at live.de
Sun Sep 12 16:04:22 EDT 2021


Hello community,

apparently my question was too hasty.
Since I did not receive an hint, I sticked to just include the 
library from the parent file.
Nonetheless, for the sake of completeness, here are two snippets I 
used to convert the $(GSC) call:

```
# single loadable file..
#$(GSC) -c -o bin/ts-java-binding.c 
 lib/lang/java/ts-java-binding.scm
#$(GSC) -link -flat -o bin/ts-java-binding.o1.c 
 bin/ts-java-binding.c
#$(GSC) -cc-options "-D___DYNAMIC" -obj bin/ts-java-binding.c 
 bin/ts-java-binding.o1.c
#gcc -shared bin/ts-java-binding.o bin/ts-java-binding.o1.o -o 
 bin/ts-java-binding.o1 -ltree-sitter -ltree-sitter-java

# working loadable lib:
#$(GSC) -c -o bin/common.c lib/lang/common.scm
#$(GSC) -c -o bin/ts-java-binding.c 
 lib/lang/java/ts-java-binding.scm
#$(GSC) -link -flat -o bin/ts-java-binding.o1.c bin/common.c 
 bin/ts-java-binding.c
#$(GSC) -cc-options "-D___DYNAMIC" -obj bin/common.c 
 bin/ts-java-binding.c bin/ts-java-binding.o1.c
#gcc -shared bin/common.o bin/ts-java-binding.o 
 bin/ts-java-binding.o1.o -o bin/ts-java-binding.o1 -ltree-sitter 
 -ltree-sitter-java

```

The latter did not link the missing pieces into the loadable file.
Since avoiding an explicit call to a C-compiler _could_ improve 
portability, I sticked two my workaround.
Obviously I have no idea how to compile/link and build anything.
So touch this with care.

Sincerly

Thomas Hage <thomas.hage at live.de> writes:

> Hello community,
>
> I want to declare procedures in a file `a`, which can be reused 
> by
> loadable libraries.
> If I understood correctly, I need to -flat -link the new file 
> `a` and
> link this together, but I don't grasp the steps.
>
> This produces my loadable library, which is working fine.
> `gsc -ld-options "-ltree-sitter -ltree-sitter-java" -o
> bin/ts-java-binding.o1 lib/lang/java/ts-java-binding.scm`
>
> But I want to access methods from file `a`, which lies in the 
> parent
> directory.
> How should I assemble the new loadable library?
>
> Thanks in advance..
>
> Thomas




More information about the Gambit-list mailing list