From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA06702 for caml-redistribution; Tue, 27 Oct 1998 20:01:41 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA07641 for ; Mon, 26 Oct 1998 16:58:26 +0100 (MET) Received: from relay5.eunet.fr (relay5.eunet.fr [193.107.193.102]) by nez-perce.inria.fr (8.8.7/8.8.7) with SMTP id QAA11239; Mon, 26 Oct 1998 16:58:20 +0100 (MET) Received: from relay2.eunet.fr by relay5.eunet.fr (5.65c8d/96.05.03) via EUnet-France id AA04655; Mon, 26 Oct 1998 17:56:41 +0100 (MET) Received: from dassav (dassav.dassault-aviation.fr [193.106.72.131]) by relay2.eunet.fr (8.8.5/8.8.5) with SMTP id RAA05865; Mon, 26 Oct 1998 17:55:45 +0100 (MET) Received: from fnet-ia1.dassault-aviation.fr by dassav (5.x/SMI-SVR4) id AA19091; Mon, 26 Oct 1998 16:50:57 +0100 Received: from fnet-ia2.fnet-ia by fnet-ia1.dassault-aviation.fr (SMI-8.6/SMI-SVR4) id RAA26820; Mon, 26 Oct 1998 17:02:51 +0100 Received: from fnet-ia2 by fnet-ia2.fnet-ia (SMI-8.6/SMI-SVR4) id RAA12214; Mon, 26 Oct 1998 17:03:30 +0100 Sender: weis Message-Id: <36349D52.1E7B@dassault-aviation.fr> Date: Mon, 26 Oct 1998 17:03:30 +0100 From: Thierry Bravier Organization: Dassault Aviation DGT/DPR/DESA X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.5.1 sun4c) Mime-Version: 1.0 To: Xavier.Leroy@inria.fr Cc: caml-list@inria.fr, Emmanuel.Dorlet@cea.fr Subject: Re: problem with ocamlmktop -output-obj References: <3624D5BE.3060@dassault-aviation.fr> <19981015192243.14795@pauillac.inria.fr> <3627228B.20CE@dassault-aviation.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Thierry Bravier wrote: > I must now face a problem: > > It would be really nice if I could use -custom but ... > > How can I ask ocamlc -custom to : > 1) use a user-provided compiled main() (potentially compiled with C++) > 2) link with a user-provided linker (aka g++) > 3) I know that internally, some C code is output and compiled > (for the external primitives I think), I think this code should > still be compiled with the C compiler used to build ocaml. > > Are there any clues to help me build this toplevel with C++ code > without -output-obj ? > > Thanks Here is a suggestion so that I can link ML with C++ and avoid using -output-obj when I don't need it (particularly to build a toplevel). with two new options for ocamlc, one could choose ... * ocamlc -cc my-ccompiler ... an alternative C compiler internally used to compile the internal primitive table and other C codes. * ocamlc -clinker my-clinker ... an alternative linker used to link native objects before concatenation of ocaml cmo files this one is most important to C++ users because it makes it possible to let a C++ tool link object files. I have emulated this thanks to an ugly hack that I would like to remove. I have made my local gcc startup script read an environment variable and link with another linker when the variable is set (in my case, a C++ linker). It gives me the ability to build a C++/ML program (or toplevel) with ocamlc (or ocamlmktop) -custom which is just what I need. I also have a request about the toplevel module: The #quit directive happens to call directly exit this is a problem if the toplevel is embedded in a C (or C++) main () function because after #quit, the program exits instead of finishing main ()'s code. In the case of C++ it's even worse because destructors are not called. I would suggest an internal toplevel_exit exception raised by #quit and handled by the toplevel loop to return properly from caml_main () Thank you. -- Thierry Bravier Dassault Aviation - DGT / DPR / DESA 78, Quai Marcel Dassault F-92214 Saint-Cloud Cedex - France Telephone : (33) 01 47 11 53 07 Telecopie : (33) 01 47 11 52 83 E-Mail : mailto:thierry.bravier@dassault-aviation.fr