Loading ...
Sorry, an error occurred while loading the content.

C++, Swig and OCaml

Expand Messages
  • Tautrimas Pajarskas
    Hello, I ve posted similar message to the OCaml main list, but did not get any response in a few days already. Therefore I m trying my luck here. So here is
    Message 1 of 1 , Jun 11, 2009
    • 0 Attachment
      Hello, I've posted similar message to the OCaml main list, but did not get
      any response in a few days already. Therefore I'm trying my luck here. So
      here is the problem: I managed to compile C++ code using Swig auto wrapper,
      but it only compiles in byte mode. If I try the almost the same procedures
      from
      http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.php#ref_cplusplusfor
      ocamlopt (linux), it fails, stating

      ocamlopt -I . -cclib -lstdc++ md5wrapper_x.cmxa caller.ml -o caller.native
      File "caller.ml", line 10, characters 6-9: Warning Y: unused variable arg.File
      "caller.ml", line 13, characters 4-54:Warning S: this expression should have
      type unit../libmd5wrapper_x.a(md5wrapper_wrap.o): In function
      `_wrap_new_md5wrappermd5wrapper': md5wrapper_wrap.cxx:(.text+0x147a):
      undefined reference to
      `md5wrapper::md5wrapper()'./libmd5wrapper_x.a(md5wrapper_wrap.o):
      In function `_wrap_delete_md5wrappermd5wrapper':md5wrapper_wrap.cxx:(.text+0x2d20):
      undefined reference to
      `md5wrapper::~md5wrapper()'./libmd5wrapper_x.a(md5wrapper_wrap.o): In
      function
      `_wrap_md5wrapper_getHashFromStringmd5wrapper':md5wrapper_wrap.cxx:(.text+0x7742):
      undefined reference to
      `md5wrapper::getHashFromString(std::basic_string<char,
      std::char_traits<char>, std::allocator<char> >)' collect2: ld returned 1
      exit statusFile "caml_startup", line 1, characters 0-1:Error: Error during
      linkingmake: *** [caller.native] Error 2 Library consists of two files:
      md5wrapper.h (main interface), md5.h, and their appropriate cpp files.
      md5wrapper_wrap.cxx is the swig's generated wrapper and md5wrapper.x.cmxa is
      the shared library.
      caller.ml is the script for using Md5wrapper module.
      Here is the Makefile: http://pastebin.com/f5f55f789 (Keep in mind that
      caller.byte target compiles perfectly).
      What can cause those undefined references?
      -- Tautrimas Pajarskas


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.