[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with libraries using C - code




Currently, to use modules that use .c files, you must build a new goo
image with those modules included.

For example, to build network sockets in to the goo image, you would:

- Edit src/eval/main.goo, and add the following line:

(use goo/io/net)

- Then, in the REPL of a running goo:

(use eval/g2c)
(g2c-test "magic") ;; sets the output dir to "g2c-magic" off of goo/c
(g2c-top) ;; builds a new image in "g2c-magic"

- Then, in your shell, in goo/c

make sub=g2c-magic

Then you have a new executable in goo/c/g2c-magic called g2c-magic,
which has the desired module already built in.

It's generally preferred when doing this to only include the core
libraries and not the application level code, thus minimizing the
amount of dynamic compilation required (and also having it work).

This obviously isn't the long-term solution, but I'm not sure that the
solution is entirely trivial, so it might be a few days.  The
obviously bad thing that is happening is that the dynamic compilation
is trying to compile and link the net.goo file without its %net.c
file, but I think the problem extends slightly further than that,
resulting in the dl's not properly generating extern's to the other C
file.  (The dynamic and image compilation steps are fairly different.)

Andrew