Hello.
> Kristian-san
I'm so sorry to thank you too late.
Now I see how to use ctags and look for some particular c files defining something in Chicken Source files.
It works; but I've faced the other problem and I do not know whether I should keep posting about it or not... For two weeks, I have been trying to solve the problem.
The script I've written in Chicken Scheme reads an external data file, or text file written like this.
$GPGGA,012345,1234.56789,N,12345.67890,E,1,08,0.00,0,M,,,,*1A
$GPRMC,012345,A,1234.56789,N,12345.67890,E,000.0,123.4,,,,*1A
$GPGGA,012346,1235.00000,N,12346.00000,E,1,08,0.00,0,M,,,,
$GPRMC,012346,A,1235.00000,N,12346.00000,E,000.0,123.4,,,,
$GPGGA,012347,1236.00000,N,12347.00000,E,1,08,0.00,0,M,,,,
$GPRMC,012347,A,1236.00000,N,12347.00000,E,.000.0,123.4,,,,
With the technique you showed me, the scheme script was compiled successfully with GCC; however, it gave me an error when I used it like this(poichan-01-1 is the name of compiled one):
➜ /tmp ./poichan-01-1 data.txt
Error: (load) unable to load compiled module - cannot load compiled code dynamically - this is a statically linked executable: "/usr/local/lib/chicken/11/format.so"
Call history:
poichan-01-1.scm:1: chicken.load#load-extension <--
➜ /tmp
➜ poichan-01 gcc -DHAVE_CHICKEN_CONFIG_H poichan-01-1.c -I . runtime.c library.c eval.c expand.c modules.c internal.c chicken-syntax.c build-version.c extras.c data-structures.c format.c -lm -o poichan-01-1
/usr/bin/ld: /tmp/ccC5fVZw.o: in function `main':
format.c:(.text+0x50772): multiple definition of `main'; /tmp/cc2oxINt.o:poichan-01-1.c:(.text+0x4610): first defined here
/usr/bin/ld: /tmp/ccC5fVZw.o: in function `C_toplevel':
format.c:(.text+0x5079f): multiple definition of `C_toplevel'; /tmp/cc2oxINt.o:poichan-01-1.c:(.text+0x463d): first defined here
/usr/bin/ld: /tmp/ccC5fVZw.o: in function `f_1526':
format.c:(.text+0x27ef): undefined reference to `C_port_toplevel'
collect2: error: ld returned 1 exit status
This time, C_port_toplevel.......
O.K.! Now is the time what Kristian-san told me would work. I went back to the Chicken Source directory and used ctags to find the file defining C_port_toplevel.
➜ chicken-5.2.0 ctags *.c
➜ chicken-5.2.0 grep C_port_toplevel tags
C_noret chicken-install.c /^C_externimport void C_ccall C_port_toplevel(C_word c,C_word *av) C_noret;$/;" v
C_noret csi.c /^C_externimport void C_ccall C_port_toplevel(C_word c,C_word *av) C_noret;$/;" v
C_noret posixunix.c /^C_externimport void C_ccall C_port_toplevel(C_word c,C_word *av) C_noret;$/;" v
C_noret posixwin.c /^C_externimport void C_ccall C_port_toplevel(C_word c,C_word *av) C_noret;$/;" v
C_noret stub.c /^C_externimport void C_ccall C_port_toplevel(C_word c,C_word *av) C_noret;$/;" v
C_port_toplevel port.c /^void C_ccall C_port_toplevel(C_word c,C_word *av){$/;"f
It seemed that "port.c" must have C_port_toplevel. I copied that in the directory I was working, and tried compiling the files again.
➜ poichan-01 gcc -DHAVE_CHICKEN_CONFIG_H poichan-01-1.c -I . runtime.c library.c eval.c expand.c modules.c internal.c chicken-syntax.c build-version.c extras.c data-structures.c format.c port.c -lm -o poichan-01-1
/usr/bin/ld: /tmp/cc0KJnH4.o: in function `main':
format.c:(.text+0x50772): multiple definition of `main'; /tmp/ccs80BV2.o:poichan-01-1.c:(.text+0x4610): first defined here
/usr/bin/ld: /tmp/cc0KJnH4.o: in function `C_toplevel':
format.c:(.text+0x5079f): multiple definition of `C_toplevel'; /tmp/ccs80BV2.o:poichan-01-1.c:(.text+0x463d): first defined here
collect2: error: ld returned 1 exit status
AGAAAAAAIN! What the hens happened???
So, I've tried fixing this problem and taken time.......
Well, there are some things I've noticed.
1. Don't use egg libraries if I want to compile my script into a C source. Stay in Chicken.
2. Arguments of the compiler become toooooo long. Now is the time to learn how to make Makefile.
Well, this was a tough adventure.
Thanks.