caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Compile and link a C program
@ 2014-10-03  9:22 Daniel Bünzli
  2014-10-03  9:35 ` Peter Zotov
  2014-10-03 10:00 ` Gerd Stolpmann
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Bünzli @ 2014-10-03  9:22 UTC (permalink / raw)
  To: Ocaml Mailing List

Hello, 

Is it possible to use ocamlc as a front-end to compile and link a C program ? 

(Just want to piggyback on ocaml's configure). 

Best,

Daniel 



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

* Re: [Caml-list] Compile and link a C program
  2014-10-03  9:22 [Caml-list] Compile and link a C program Daniel Bünzli
@ 2014-10-03  9:35 ` Peter Zotov
  2014-10-03  9:38   ` Daniel Bünzli
  2014-10-03 10:00 ` Gerd Stolpmann
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Zotov @ 2014-10-03  9:35 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: Ocaml Mailing List, caml-list-request

On 2014-10-03 13:22, Daniel Bünzli wrote:
> Hello,
> 
> Is it possible to use ocamlc as a front-end to compile and link a C 
> program ?
> 
> (Just want to piggyback on ocaml's configure).

You can compile it with ocamlc foo.c, but I think you cannot trick
ocamlc into linking it.

-- 
Peter Zotov

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

* Re: [Caml-list] Compile and link a C program
  2014-10-03  9:35 ` Peter Zotov
@ 2014-10-03  9:38   ` Daniel Bünzli
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Bünzli @ 2014-10-03  9:38 UTC (permalink / raw)
  To: Peter Zotov; +Cc: Ocaml Mailing List, caml-list-request

Le vendredi, 3 octobre 2014 à 11:35, Peter Zotov a écrit :
> You can compile it with ocamlc foo.c, but I think you cannot trick
> ocamlc into linking it.

Yes that's the bit I'm missing.  

Daniel



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

* Re: [Caml-list] Compile and link a C program
  2014-10-03  9:22 [Caml-list] Compile and link a C program Daniel Bünzli
  2014-10-03  9:35 ` Peter Zotov
@ 2014-10-03 10:00 ` Gerd Stolpmann
  1 sibling, 0 replies; 4+ messages in thread
From: Gerd Stolpmann @ 2014-10-03 10:00 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: Ocaml Mailing List

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

Am Freitag, den 03.10.2014, 11:22 +0200 schrieb Daniel Bünzli:
> Hello, 
> 
> Is it possible to use ocamlc as a front-end to compile and link a C program ? 

If you compile it, ocamlc will add the compiler options it uses for
itself (like adding -I<stdlib>). This is usually the right thing to do
for compiling wrappers.

I don't think you can link anything without an ml module.

>(Just want to piggyback on ocaml's configure). 

Another way is to extract all the options from ocamlc -config.

Gerd




> Best,
> 
> Daniel 
> 
> 
> 

-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
My OCaml site:          http://www.camlcity.org
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2014-10-03 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-03  9:22 [Caml-list] Compile and link a C program Daniel Bünzli
2014-10-03  9:35 ` Peter Zotov
2014-10-03  9:38   ` Daniel Bünzli
2014-10-03 10:00 ` Gerd Stolpmann

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