From: "Alexander Bottema" <Alexander.Bottema@mathworks.com>
To: <caml-list@inria.fr>
Subject: OCAML and Dynamic Libraries
Date: Thu, 11 Aug 2005 16:17:23 -0400 [thread overview]
Message-ID: <DB873318D1A41648BEAC4B5AAB63B3E10A13F301@MESSAGE-AH.ad.mathworks.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2485 bytes --]
Hi all OCAML users,
Our group is considering using OCAML 3.08.3 (i.e. the currently latest
version) for a project on the MathWorks, but we have run into some
problems.
Currently, the platforms that we need to support are: Linux (I386),
Linux (AMD64), Windows 2000 (and XP), Solaris 2 and Mac OS X.
I've been able to successfully build and run OCAML on all platforms and
there are no problems in creating standalone executables (via ocamlopt)
on all mentioned platforms.
We need to create a dynamic link library (containing OCAML code) because
the execution context needs to share data on the same heap as the main
process (MATLAB in our case). I've been able to successfully do this for
Windows and Linux I386. I think that Solaris 2 should work as well,
although this is currently under investigation.
However, on the Linux AMD64 and Mac OS X platforms I consistently get
the following errors:
(Although this is not the actual steps for us, it produces the same
error):
Linux AMD64:
==========
ocamlopt -output-obj -o test_obj.o test.ml
ocamlmklib -o test test_obj.o
/usr/bin/ld: test_obj.o: relocation R_X86_64_32S against `caml_curry2_1'
can not be used when making a shared object; recompile with -fPIC
test_obj.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Mac OS X:
========
ld: test_obj.o has external relocation entries in non-writable section
(__TEXT,__text) for symbols:
_caml_call_gc
_caml_globals_inited
_caml_c_call
ld: test_obj.o has local relocation entries in non-writable section
(__TEXT,__text)
-----
The test.ml just contains:
print_string "Hello World\n";;
Although this is a meaningless DLL it shouldn't fail to build (and it
successfully builds on Linux I386 and Windows). I've been able to write
a program that calls ocaml_startup and get the right answer by calling a
registered ocaml function in such a DLL (successfully proven for Solaris
2, Linux I386, and Win32).
The questions are:
What's going on?
Is the OCAML compiler emitting some kind of object code that is not
recognized by the linkers on these two platforms?
Can I easily fix this?
Have others have had the same experience?
If it is currently unsupported, will/when it be supported?
Thanks,
Alexander Bottema
Senior Software Developer
Embedded MATLAB, The MathWorks
[-- Attachment #2: Type: text/html, Size: 10236 bytes --]
reply other threads:[~2005-08-11 20:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=DB873318D1A41648BEAC4B5AAB63B3E10A13F301@MESSAGE-AH.ad.mathworks.com \
--to=alexander.bottema@mathworks.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