caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Stork <cstork@ics.uci.edu>
To: caml-list@inria.fr
Subject: CamlIDL question
Date: Tue, 25 Oct 2005 15:26:12 -0700	[thread overview]
Message-ID: <20051025222612.GA14471@anthony.ics.uci.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

I must be making a stupid mistake but I just don't see it.  I put together a
simple example that shows the problem.  Even though the camlidl library is
found its symbol "camlidl_free" is not.  How can that be?  Can anybody
reproduce the problem or is this some hickup on my system?

Here's what make produces (all files attached):

make extest
camlidl -header ex.idl
ocamlc -c ex.mli
ocamlc -c extest.ml
gcc -c ex.c
gcc -c ex_stubs.c
ocamlc -c ex.ml
ocamlc -verbose -custom -cclib -lcamlidl -o extest \
    ex.o ex_stubs.o ex.cmo extest.cmo
+ gcc -Wl,-E -o 'extest' -I'/usr/lib/ocaml/3.08.3'  /home/chs/tmp/camlprim262817.c  '-L/usr/lib/ocaml/3.08.3' '-lcamlidl' 'ex.o' 'ex_stubs.o' -lcamlrun -lm  -ldl -lcurses -lpthread
ex_stubs.o: In function `camlidl_ex_g':
ex_stubs.c:(.text+0x79): undefined reference to `camlidl_free'
ex_stubs.o: In function `camlidl_ex_f':
ex_stubs.c:(.text+0xd3): undefined reference to `camlidl_free'
collect2: ld returned 1 exit status
Error while building custom runtime system
make: *** [extest] Error 2

-- 
Chris Stork   <>  Support eff.org!  <>   http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint:  B08B 602C C806 C492 D069  021E 41F3 8C8D 50F9 CA2F

[-- Attachment #2: Makefile --]
[-- Type: text/plain, Size: 521 bytes --]

OCAMLC := ocamlc

all: extest

ex.cmi: ex.mli
	$(OCAMLC) -c ex.mli

ex.cmo: ex.cmi ex.ml
	$(OCAMLC) -c ex.ml

ex.h ex.ml ex.mli ex_stubs.c: ex.idl
	camlidl -header ex.idl

ex.o: ex.c ex.h
	gcc -c ex.c

ex_stubs.o: ex_stubs.c ex.h
	gcc -c ex_stubs.c

extest.cmo: ex.cmi extest.ml
	$(OCAMLC) -c extest.ml

extest: extest.cmo ex.o ex_stubs.o ex.cmo
	$(OCAMLC) -verbose -custom -cclib -lcamlidl -o extest \
	    ex.o ex_stubs.o ex.cmo extest.cmo


clean: 
	rm -f *.cmo *.cmi *.o *~
	rm -f ex_stubs.* ex.h ex.ml ex.mli extest

[-- Attachment #3: ex.idl --]
[-- Type: text/plain, Size: 64 bytes --]

typedef [abstract] struct foo_s * foo;

foo g();
int f(foo e);


[-- Attachment #4: ex.c --]
[-- Type: text/x-csrc, Size: 161 bytes --]

#include "ex.h"

struct foo_s {int i;};

foo g()
{
  foo e = (foo) malloc (sizeof(struct foo_s));
  e->i = 10;
  return e;
}

int f(foo e)
{
    return e->i;
}


[-- Attachment #5: extest.ml --]
[-- Type: text/plain, Size: 65 bytes --]

open Ex
;;
let e = g ();;
print_int (f e);;
print_string "\n";;


             reply	other threads:[~2005-10-25 22:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-25 22:26 Christian Stork [this message]
2005-10-26  5:03 ` [Caml-list] " Igor Pechtchanski
2005-10-26 11:11   ` Christian Stork

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=20051025222612.GA14471@anthony.ics.uci.edu \
    --to=cstork@ics.uci.edu \
    --cc=caml-list@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;
as well as URLs for NNTP newsgroup(s).