From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=AWL,NO_REAL_NAME,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 07444BBAF for ; Mon, 20 Jul 2009 16:57:45 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AusAABQjZErPLfmtkWdsb2JhbACPBIk8InkBAQEBCQsKBxMFoEOVYII4gVQFgT9ihy0 X-IronPort-AV: E=Sophos;i="4.43,235,1246831200"; d="scan'208";a="33303934" Received: from unknown (HELO parmail02.sgcib.com) ([207.45.249.173]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 20 Jul 2009 16:57:44 +0200 X-IronPort-AV: E=Sophos;i="4.43,235,1246831200"; d="scan'208";a="31453264" Content-class: urn:content-classes:message MIME-Version: 1.0 X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: RE: [Caml-list] how to use c wrapper files in libraries Date: Mon, 20 Jul 2009 16:58:14 +0200 Message-ID: <1BB928AA56A7E74DB134B7F5CDDA390C056072F1@frcor-exmb04.europe.am.socgen> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Caml-list] how to use c wrapper files in libraries Thread-Index: AcoJRnEmiOE4L8HySKiTzcRFlHPGcwAA3E+g References: From: To: , X-OriginalArrivalTime: 20 Jul 2009 14:58:15.0541 (UTC) FILETIME=[82842A50:01CA094A] X-NAI-Spam-Score: -2.5 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; ocamlc:01 -cclib:01 ocamlc:01 -verbose:01 contrib:01 ocaml:01 compile-time:01 ocaml:01 -custom:01 stub:01 cmo:01 usr:01 lib:01 -cclib:01 stub:01 I am not familiar with this specific library. In the general approach, you compile your c code, and package it into a lib= rary, let's say libA.a Then while building your sndfile.cma, you should pass the option ocamlc -a -o sndfile.cma -cclib -lA ... A caml executable linked with your library will have also libA.a passed in = the linking phase. Using ocamlc -verbose could give you a hint to which files are missing. Hope this helps, Rabih -----Message d'origine----- De=A0: caml-list-bounces@yquem.inria.fr [mailto:caml-list-bounces@yquem.inr= ia.fr] De la part de Aaron Bohannon Envoy=E9=A0: lundi 20 juillet 2009 16:28 =C0=A0: caml-list@yquem.inria.fr Objet=A0: [Caml-list] how to use c wrapper files in libraries Hello, I am trying to use the wrapper for libsndfile contributed by Erik de Castro Lopo (http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=3D556). The wrapper code compiles just fine. And the tests that use the OCaml library it builds work just fine. However, I am having a frustrating compile-time error when I try to compile my program in a different directory. The wrapper code is being packaged into an OCaml library using the following command: ocamlc -a -o sndfile.cma -custom sndfile_stub.o sndfile.cmo \ -ccopt -L/usr/local/lib -cclib -lsndfile Within the same directory, the test program can be successfully compiled wi= th: ocamlc -o test_sndfile sndfile.cma test_sndfile.ml Within a different directory, I used: ocamlc -o mytest -I /path/to/libsndfile-ocaml/files/ sndfile.cma mytest= .ml And I get: powerpc-apple-darwin8-gcc-4.0.1: sndfile_stub.o: No such file or directory Error while building custom runtime system I have tried setting every path-related option I could find, and nothing helped. I tried reading everything I could find about compiling and using c wrappers for OCaml, but there is a severe lack of documentation on the topic. In particular, I could find no example of a c object file being given as an argument to an "ocamlc -a" command, so I am not sure what that is supposed to do, which makes it impossible for me to understand this error message. I am using OCaml 3.10.1 on OS X 10.4. Any help would be appreciated. - Aaron _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs This message and any attachments (the "message") are confidential, intended= solely for the addressee(s), and may contain legally privileged informatio= n.=20 Any unauthorised use or dissemination is prohibited.=20 E-mails are susceptible to alteration.=20 Neither Societe Generale Asset Management nor any of its subsidiaries or af= filiates shall be liable for the message if altered, changed or falsified.=20 =20 Find out more about Societe Generale Asset Management's proposal on www.sga= m.com =20 ********=20 =20 Ce message et toutes les pieces jointes (ci-apres le "message") sont confid= entiels et susceptibles de contenir des informations couvertes par le secre= t professionnel. Ce message est etabli a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite.=20 Tout message electronique est susceptible d'alteration. Societe Generale As= set Management et ses filiales declinent toute responsabilite au titre de c= e message s'il a ete altere, deforme ou falsifie.=20 Decouvrez l'offre et les services de Societe Generale Asset Management sur = le site www.sgam.fr