caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* CamlIDL question
@ 2005-10-25 22:26 Christian Stork
  2005-10-26  5:03 ` [Caml-list] " Igor Pechtchanski
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Stork @ 2005-10-25 22:26 UTC (permalink / raw)
  To: caml-list

[-- 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";;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] CamlIDL question
  2005-10-25 22:26 CamlIDL question Christian Stork
@ 2005-10-26  5:03 ` Igor Pechtchanski
  2005-10-26 11:11   ` Christian Stork
  0 siblings, 1 reply; 3+ messages in thread
From: Igor Pechtchanski @ 2005-10-26  5:03 UTC (permalink / raw)
  To: Christian Stork; +Cc: caml-list

On Tue, 25 Oct 2005, Christian Stork wrote:

> 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):
> [snip]
> make extest
> ocamlc -verbose -custom -cclib -lcamlidl -o extest \
>     ex.o ex_stubs.o ex.cmo extest.cmo

Shouldn't this be

ocamlc -verbose -custom -cclib -o extest \
    ex.o ex_stubs.o ex.cmo extest.cmo -lcamlidl

instead?  Libraries should follow objects that refer to them...
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] CamlIDL question
  2005-10-26  5:03 ` [Caml-list] " Igor Pechtchanski
@ 2005-10-26 11:11   ` Christian Stork
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Stork @ 2005-10-26 11:11 UTC (permalink / raw)
  To: caml-list

On Wed, Oct 26, 2005 at 01:03:45AM -0400, Igor Pechtchanski wrote:
> On Tue, 25 Oct 2005, Christian Stork wrote:

> > 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):
> > [snip]
> > make extest
> > ocamlc -verbose -custom -cclib -lcamlidl -o extest \
> >     ex.o ex_stubs.o ex.cmo extest.cmo

> Shouldn't this be

> ocamlc -verbose -custom -cclib -o extest \
>     ex.o ex_stubs.o ex.cmo extest.cmo -lcamlidl

> instead?  Libraries should follow objects that refer to them...

Thanks, that was it.

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-10-26 11:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-25 22:26 CamlIDL question Christian Stork
2005-10-26  5:03 ` [Caml-list] " Igor Pechtchanski
2005-10-26 11:11   ` Christian Stork

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).