From: Dmitri Boulytchev <db@tepkom.ru>
To: caml-list <caml-list@yquem.inria.fr>
Subject: Statically linking with C object files by bootstrap ocamlc under Cygwin.
Date: Sun, 25 Jan 2009 23:10:03 +0300 [thread overview]
Message-ID: <497CC71B.7000404@tepkom.ru> (raw)
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.
reply other threads:[~2009-01-25 20:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=497CC71B.7000404@tepkom.ru \
--to=db@tepkom.ru \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox