caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* non trivial (at least not to me) Hybrid program compiling
@ 2007-03-11 18:22 Manuel Preliteiro
  2007-03-11 18:26 ` [Caml-list] " Chris King
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel Preliteiro @ 2007-03-11 18:22 UTC (permalink / raw)
  To: caml-list

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

Hello, i'm trying to make a OCaml binding to C library PCSCLite, and i'm not
being able to compile it, because for instance, when i try to compile the
pcsc_demo.c provided by MUSCLE i do the folowing steps:

cc `pkg-config libpcsclite --cflags` -c pcsc_demo.c
cc `pkg-config libpcsclite --libs` -o pcsc_demo pcsc_demo.o

then when i try to compile my own program i can make the 1st step as above,
only ading the OCaml lib path:

cc `pkg-config libpcsclite --cflags` -I/usr/lib/ocaml -c testC.c

but the problem comes when i have use the OCaml compiler to link to my OCaml
and C parts, i tried (with variations):

ocamlopt `pkg-config libpcsclite --libs` -o test testC.o testML.ml

but i get an option usage error...

The error is preaty explicit so i'm not obeying the compiling rules, but i'm
not geting how i'm gonna add the `pkg-config libpcsclite --libs` part,
because if i dont the C API wont be recognized by the OCaml linker...

Thank You
Manuel

[-- Attachment #2: Type: text/html, Size: 1036 bytes --]

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

* Re: [Caml-list] non trivial (at least not to me) Hybrid program compiling
  2007-03-11 18:22 non trivial (at least not to me) Hybrid program compiling Manuel Preliteiro
@ 2007-03-11 18:26 ` Chris King
  0 siblings, 0 replies; 2+ messages in thread
From: Chris King @ 2007-03-11 18:26 UTC (permalink / raw)
  To: Manuel Preliteiro; +Cc: caml-list

On 3/11/07, Manuel Preliteiro <hankalagon@gmail.com> wrote:
> ocamlopt `pkg-config libpcsclite --libs` -o test testC.o testML.ml

You want to use the --ccopt and --cclib flags to pass the options to
the C compiler; e.g:

ocamlopt -cclib `pkg-config libpcsclite --libs` -o test testC.o testML.ml

or

ocamlopt -ccopt `pkg-config libpcsclite --cflags` -o test testC.c testML.ml

HTH.

- Chris


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

end of thread, other threads:[~2007-03-11 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-11 18:22 non trivial (at least not to me) Hybrid program compiling Manuel Preliteiro
2007-03-11 18:26 ` [Caml-list] " Chris King

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