* Statically linking with C object files by bootstrap ocamlc under Cygwin.
@ 2009-01-25 20:10 Dmitri Boulytchev
0 siblings, 0 replies; only message in thread
From: Dmitri Boulytchev @ 2009-01-25 20:10 UTC (permalink / raw)
To: caml-list
Hello,
just curious: why can't I produce mixed ocaml+c executable using
bootstrap compiler?
File test.ml:
external cstring: unit -> string = "cstring";;
Printf.printf "%s\n" (cstring ())
File testc.c:
#include <ctype.h>
#include <mlvalues.h>
#include <alloc.h>
#include <memory.h>
#include <fail.h>
#include <string.h>
CAMLprim value cstring()
{
CAMLparam0();
CAMLlocal1(res);
char * q;
res = alloc_string(7);
q = String_val(res);
strcpy (q, "Hello!");
CAMLreturn(res);
}
$ gcc -I ../byterun -c testc.c
$ ../boot/ocamlrun.exe ../boot/ocamlc -nostdlib -I ../boot -custom
-o test testc.o test.ml
../boot/libcamlrun.a(unix.o):unix.c:(.text+0x465): undefined
reference to `_flexdll_dlopen'
../boot/libcamlrun.a(unix.o):unix.c:(.text+0x478): undefined
reference to `_flexdll_dlclose'
../boot/libcamlrun.a(unix.o):unix.c:(.text+0x492): undefined
reference to `_flexdll_dlsym'
../boot/libcamlrun.a(unix.o):unix.c:(.text+0x4ae): undefined
reference to `_flexdll_dlopen'
../boot/libcamlrun.a(unix.o):unix.c:(.text+0x4bd): undefined
reference to `_flexdll_dlsym'
../boot/libcamlrun.a(unix.o):unix.c:(.text+0x4ca): undefined
reference to `_flexdll_dlerror'
collect2: ld returned 1 exit status
File "test.ml", line 1, characters 0-1:
Error: Error while building custom runtime system
$ ../boot/ocamlrun.exe ../ocamlc -nostdlib -I ../boot -custom -o test
testc.o test.ml
$ ./test
Hello!
What do I do wrong?
Best regards,
Dmitri Boulytchev,
St.Petersburg State University.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-01-25 20:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-25 20:10 Statically linking with C object files by bootstrap ocamlc under Cygwin Dmitri Boulytchev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox