Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Ocaml and Samba function name collisions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Blair Zajac <blair@o...>
Subject: [Caml-list] Ocaml and Samba function name collisions
Hello,

The synopsis of this message is to ask that the Ocaml source
code prepend a Ocaml specific string, "ml_", "caml_" or "ocaml_"
to all function names in Ocaml's source code to avoid name
collisions with other packages.  My case is made below :)

I'm using mod_caml and mod_smbauth in an Apache 1 process.
mod_smbauth is used to authenticate access to the web server
using our ActiveDirectory server.

http://www.tekrat.com/smbauth.php

When mod_caml.so is enabled in Apache httpd's conf file, it
core dumps with this stack backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1075767456 (LWP 3544)]
0x40b8a9cc in string_init (dest=0x40cb146c, src=0x1 <Address 0x1
out of bounds>) at lib/util_str.c:1142
1142      l = strlen(src);
(gdb) bt
#0  0x40b8a9cc in string_init (dest=0x40cb146c, src=0x1
<Address 0x1 out of bounds>) at lib/util_str.c:1142
#1  0x40b8ab21 in string_set (dest=0x1, src=0x0) at lib/util_str.c:1187
#2  0x40c34a4e in interprete () from
/opt/i386-linux/installed/apache-1.3.29-g/libexec/mod_caml.so
#3  0x40c265b1 in caml_main () from
/opt/i386-linux/installed/apache-1.3.29-g/libexec/mod_caml.so
#4  0x40c22ff4 in init () at mod_caml_c.c:80
#5  0x40c36975 in __do_global_ctors_aux () from
/opt/i386-linux/installed/apache-1.3.29-g/libexec/mod_caml.so
#6  0x40c20b95 in _init () from
/opt/i386-linux/installed/apache-1.3.29-g/libexec/mod_caml.so
...

Looking at the function names, both the Samba library and the
Ocaml source code have a function named string_set.  It's odd
though that the function name is binding to the Samba function
in mod_smbauth.so instead of the name in mod_caml.so, but then
I'm not an expert in shared library binding.

% nm mod_caml.so | grep string_set
00019846 T string_set
% nm mod_smbauth.so | grep string_set
00052afe T string_set
000552f9 T string_set_w

Now this may be a bug that can be worked around, but given
Ocaml's popularity in being linked with other packages, it
seems like a good idea to put all the Ocaml names into their
own space via a prepend.

I'd be happy to do some of this work by submitting patches to
the appropriate people/mailing list for review.  Let me know.

Best,
Blair

-- 
Blair Zajac <blair@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners