Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Ohad Rodeh <orodeh@cs.huji.ac.il>
To: caml-list@inria.fr
Subject: Calling C++ from Caml
Date: Sun, 16 Apr 2000 16:40:44 +0300 (IDT)	[thread overview]
Message-ID: <Pine.LNX.4.20_heb2.08.0004161630460.6495-100000@zigzag.cs.huji.ac.il> (raw)

Hello,
  I'm trying to use C++ code from within Caml. Currently,
the compiler cannot find the requested functions in the compiled
C++ code. 

  A very simple example fails. I have two files:
dh.ml : ML code
xx.cpp : C++ code

The C++ code contains the function:
	value dhml_Try(value dummy) {
	   return Val_unit;
	}
The ML code calls dhml_Try using:
	external dhml_Try : unit -> unit 
	  = "dhml_Try"

	let _ = 
	   dhml_Try();
	   ()	

The compilation seqeunce is as follows:
	c++ -c -w -I$(CAMLLIB) xx.cpp -o xx.o
	ocamlc -c dh.ml
	ocamlc -cc c++ -custom -o dh  xx.o dh.cmo	
/tmp/ccEPQ4W1.o(.data+0x248): undefined reference to `dhml_Try'

  If I use the gcc compiler with C code, instead of C++, this 
sequence works fine. How can I fix this problem? 

    Thanks,
	Ohad.




             reply	other threads:[~2000-04-17 18:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-16 13:40 Ohad Rodeh [this message]
2000-04-17 19:25 ` John Prevost

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=Pine.LNX.4.20_heb2.08.0004161630460.6495-100000@zigzag.cs.huji.ac.il \
    --to=orodeh@cs.huji.ac.il \
    --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