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; 7+ 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] 7+ messages in thread
* [Caml-list] CamlIDL question
@ 2002-10-07 14:02 Yurii A. Rashkovskii
  2002-10-13  8:48 ` Xavier Leroy
  0 siblings, 1 reply; 7+ messages in thread
From: Yurii A. Rashkovskii @ 2002-10-07 14:02 UTC (permalink / raw)
  To: caml-list

Gentlemen,

Is the below trick is possible in CamlIDL?

I want to wrap C library that uses structs for storing
pointers to functions, like

typedef struct {
        int (*open)(char *filename);
} blablabla;

I want to wrap it automatically to something like

type blablabla = 
{
   open: (string -> int)
}
;;

Is it possible?


-- 
Thanks in advance,
Yurii.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

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

Thread overview: 7+ 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
  -- strict thread matches above, loose matches on Subject: below --
2002-10-07 14:02 Yurii A. Rashkovskii
2002-10-13  8:48 ` Xavier Leroy
2002-10-13 17:10   ` Dmitry Bely
2002-10-13 23:12     ` Chris Hecker

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