* [Caml-list] Shared object generation patch.
@ 2001-10-06 2:11 malc
2001-10-08 2:25 ` [Caml-list] Shared object generation patch feedback Jeff Henrikson
0 siblings, 1 reply; 3+ messages in thread
From: malc @ 2001-10-06 2:11 UTC (permalink / raw)
To: caml-list
Hello,
At http://algol.prosalg.no/~malc/scaml you will find a patch against
OCaml 3.02 and some information suitable for producing shared objects
on i386 ELF systems.
--
mailto:malc@pulsesoft.com
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Caml-list] Shared object generation patch feedback
2001-10-06 2:11 [Caml-list] Shared object generation patch malc
@ 2001-10-08 2:25 ` Jeff Henrikson
2001-10-08 9:18 ` malc
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Henrikson @ 2001-10-08 2:25 UTC (permalink / raw)
To: malc; +Cc: caml-list
> At http://algol.prosalg.no/~malc/scaml you will find a patch against
> OCaml 3.02 and some information suitable for producing shared objects
> on i386 ELF systems.
Nice! It compiled right out of the box, no unexpected difficulties.
Is there a way to get a asm runtime in a shared lib? (Either for the purposes of having small executables or for calling from
non-caml)
I am having a hard time understanding how this works due to the fact that I don't understand the ocaml calling/symbol naming
convention. I've been reading some assembly intermediary files and nm dumps, but I am still confused and am wondering if there's
some general documentation somewhere.
Here's an example of something that confuses me. I make a file testlib.ml:
> open Printf;;
>
> let rec print_int_list x =
> match x with
> [] -> ()
> | hd::tl -> printf "%d " hd; (print_int_list tl);;
>
> let rec mymap f l =
> match l with
> [] -> []
> | hd::tl -> (f hd)::(mymap f tl);;
and I nm testlib.so and get
> 000010c0 T Testlib_code_begin
> 0000118a T Testlib_code_end
> 000023f4 D Testlib_data_begin
> 00002424 D Testlib_data_end
> 00001170 T Testlib_entry
> 00002428 D Testlib_frametable
> 00001100 T Testlib_mymap_53
> 000010c0 T Testlib_print_int_list_49
So I wonder:
1) where do the numbers 53 and 49 come from, and do I care? For example, if they are arbitrary (as I surmise) and socked away in
testlib.so.cmxa, then don't I get screwed if I try to build an program linked against testlib.so.cmxa and then decide that I want
to change the implementation of testlib? If so, is there a way to define a symbol table just from an mli? (A .so.cmi file or
something?) This command only produces a .cmi:
ocamlopt -shared -o foo.so foo.mli
2) what do the other entry points mean, eg Testlib_entry, and do I care?
Great work if this actually is heading down the path to real system deployment with ocaml!
Jeff Henrikson
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Shared object generation patch feedback
2001-10-08 2:25 ` [Caml-list] Shared object generation patch feedback Jeff Henrikson
@ 2001-10-08 9:18 ` malc
0 siblings, 0 replies; 3+ messages in thread
From: malc @ 2001-10-08 9:18 UTC (permalink / raw)
To: Jeff Henrikson; +Cc: caml-list
On Sun, 7 Oct 2001, Jeff Henrikson wrote:
> > At http://algol.prosalg.no/~malc/scaml you will find a patch against
> > OCaml 3.02 and some information suitable for producing shared objects
> > on i386 ELF systems.
>
> Nice! It compiled right out of the box, no unexpected difficulties.
>
> Is there a way to get a asm runtime in a shared lib? (Either for the purposes of having small executables or for calling from
> non-caml)
Yes. (ocamlopt -shared ... -ccopt "-L`ocamlc -where` -lasmrun -u caml_main")
>
> I am having a hard time understanding how this works due to the fact that I don't understand the ocaml calling/symbol naming
> convention. I've been reading some assembly intermediary files and nm dumps, but I am still confused and am wondering if there's
> some general documentation somewhere.
>
> Here's an example of something that confuses me. I make a file testlib.ml:
>
> > open Printf;;
> >
> > let rec print_int_list x =
> > match x with
> > [] -> ()
> > | hd::tl -> printf "%d " hd; (print_int_list tl);;
> >
> > let rec mymap f l =
> > match l with
> > [] -> []
> > | hd::tl -> (f hd)::(mymap f tl);;
>
> and I nm testlib.so and get
>
> > 000010c0 T Testlib_code_begin
> > 0000118a T Testlib_code_end
> > 000023f4 D Testlib_data_begin
> > 00002424 D Testlib_data_end
> > 00001170 T Testlib_entry
> > 00002428 D Testlib_frametable
> > 00001100 T Testlib_mymap_53
> > 000010c0 T Testlib_print_int_list_49
>
> So I wonder:
>
> 1) where do the numbers 53 and 49 come from, and do I care? For example, if they are arbitrary (as I surmise) and socked away in
> testlib.so.cmxa, then don't I get screwed if I try to build an program linked against testlib.so.cmxa and then decide that I want
> to change the implementation of testlib? If so, is there a way to define a symbol table just from an mli? (A .so.cmi file or
> something?) This command only produces a .cmi:
OCaml add those suffixes for variety of reasons, something must be done
about it (on the linking stage), if people want -shared to take off.
>
> ocamlopt -shared -o foo.so foo.mli
Naturally. There is nothing to compile, leave alone link here :)
>
> 2) what do the other entry points mean, eg Testlib_entry, and do I care?
Those are module toplevel forms. _frametable, _code[data]_begin[end] are
used by GC, equality comparisions, marshaling etc.
>
> Great work if this actually is heading down the path to real system deployment with ocaml!
There is still a lot to be done, to make it really useful. But thanks for
encouragment, i needed it.
>
>
> Jeff Henrikson
--
mailto:malc@pulsesoft.com
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-10-08 9:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-06 2:11 [Caml-list] Shared object generation patch malc
2001-10-08 2:25 ` [Caml-list] Shared object generation patch feedback Jeff Henrikson
2001-10-08 9:18 ` malc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox