* [Caml-list] Main program in C - a script
@ 2013-12-02 15:26 John Whitington
2013-12-02 15:59 ` Mykola
0 siblings, 1 reply; 3+ messages in thread
From: John Whitington @ 2013-12-02 15:26 UTC (permalink / raw)
To: caml-list
Hi,
There has been some confusion on this topic over the years, since plenty
of OCaml programmers aren't au fait with archive managers and linkers
and so on. Certainly I wasn't.
Anyway, here's a script which might help:
http://github.com/johnwhitington/ocaml-main-program-in-c
On Linux / OS X it builds a static library from C and OCaml sources,
ocamlfind packages, and ocaml libraries like unix and bigarray and then
tests it by linking an example.
On Windows, it does the same, linking the example with flexlink.
Additionally, it builds a DLL, and test links that with the system C linker.
Here's an example config, for building the libcpdf.(a|dll) version of my
CPDF tools:
cfiles=(cpdflibwrapper)
finalcfile=cpdflibtest
libname=cpdf
mlfiles=(cpdflib)
mlifiles=(cpdflib)
mllibs=(unix bigarray)
ocamlfind=ocamlfind
ocamlfind_packs=(camlpdf cpdf)
stubs=(camlpdf)
Unfortunately, I've been unable to work out a way to roll ocaml
libraries like unix and bigarray into the .a so that only a single
linker flag -lcpdf would be needed when the .a is shipped to a customer.
If anyone does know, do tell.
In addition, it's native code only for now. But this stuff should all be
possible with bytecode too.
The original idea for this script was from Gerd's article here:
http://www.camlcity.org/knowledge/kb_002_shared_library.html
This is not an area of my expertise, and has only been tested on the
sample project and libcpdf, so pull requests and bug reports are most
welcome!
With Thanks,
--
John Whitington
Director, Coherent Graphics Ltd
http://www.coherentpdf.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Main program in C - a script
2013-12-02 15:26 [Caml-list] Main program in C - a script John Whitington
@ 2013-12-02 15:59 ` Mykola
2013-12-03 6:03 ` Mihamina RKTMB
0 siblings, 1 reply; 3+ messages in thread
From: Mykola @ 2013-12-02 15:59 UTC (permalink / raw)
To: John Whitington; +Cc: caml-list
Hi,
On 2 груд. 2013, at 17:26, John Whitington <john@coherentgraphics.co.uk> wrote:
> There has been some confusion on this topic over the years, since plenty of OCaml programmers aren't au fait with archive managers and linkers and so on. Certainly I wasn't.
>
> Anyway, here's a script which might help:
>
> http://github.com/johnwhitington/ocaml-main-program-in-c
JFYI: there is absolutely amazing page about using C and OCaml together.
http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Main program in C - a script
2013-12-02 15:59 ` Mykola
@ 2013-12-03 6:03 ` Mihamina RKTMB
0 siblings, 0 replies; 3+ messages in thread
From: Mihamina RKTMB @ 2013-12-03 6:03 UTC (permalink / raw)
To: caml-list
On 12/02/2013 06:59 PM, Mykola wrote:
> Hi,
>
> On 2 груд. 2013, at 17:26, John Whitington <john@coherentgraphics.co.uk> wrote:
>
>> There has been some confusion on this topic over the years, since plenty of OCaml programmers aren't au fait with archive managers and linkers and so on. Certainly I wasn't.
>>
>> Anyway, here's a script which might help:
>>
>> http://github.com/johnwhitington/ocaml-main-program-in-c
> JFYI: there is absolutely amazing page about using C and OCaml together.
> http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.html
>
Thank you Mykola, it's a very understandable introduction to the topic.
--
+261 34 81 738 69
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-03 6:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-02 15:26 [Caml-list] Main program in C - a script John Whitington
2013-12-02 15:59 ` Mykola
2013-12-03 6:03 ` Mihamina RKTMB
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox