From: peter.ilberg@ni.com
To: caml-list@inria.fr
Subject: Re: [Caml-list] Linking native ocaml object files into C app on Windows
Date: Thu, 10 Jun 2004 12:28:00 -0500 [thread overview]
Message-ID: <OFAE6A6D55.E5534ACB-ON86256EAF.005EFE43-86256EAF.005FF21F@natinst.com> (raw)
In-Reply-To: <20040610190443.A10900@pauillac.inria.fr>
That's it! Everything builds, links and runs fine! Thank you!
Peter
Xavier Leroy <xavier.leroy@inria.fr>
06/10/2004 12:04 PM
To: peter.ilberg@ni.com
cc:
Subject: Re: [Caml-list] Linking native ocaml object files
into C app on Windows
> I'm trying to add some ocaml code (a simple lexer/parser) to an existing
C
> application and I'm having problems linking the whole thing on Windows.
> Needless to say, everything works fine under Unix (Mac OS X). I'm using
> the MSVC version of ocaml.
>
> Here's are the commands that I use to build the whole thing:
>
> cl /c /nologo /MT /I "C:\Program Files\Objective Caml\lib" main.c
> ocamllex lexer.mll
> ocamlopt -c -output-obj lexer.ml -o lexer.obj
Three problems:
1) -c turns linking off, while you really want to do a
(partial) link here.
2) The compilation of lexer.ml already
produces lexer.obj, so you give lexer.obj both as input and as output
to the partial linker, which can break things.
3) With the MSVC port, the output of the partial linker is a .lib file,
not a .obj file, so it would be prudent to name the output
appropriately.
Try this instead:
ocamlopt -output-obj -o lexer.lib lexer.ml
Hope this helps,
- Xavier Leroy
-------------------
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
next parent reply other threads:[~2004-06-10 17:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20040610190443.A10900@pauillac.inria.fr>
2004-06-10 17:28 ` peter.ilberg [this message]
[not found] <40C87D7B.6010504@lexifi.com>
2004-06-10 16:07 ` peter.ilberg
2004-06-10 14:07 peter.ilberg
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=OFAE6A6D55.E5534ACB-ON86256EAF.005EFE43-86256EAF.005FF21F@natinst.com \
--to=peter.ilberg@ni.com \
--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