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: Samuel Mimram <samuel.mimram@e...>
Subject: Re: [Caml-list] Ocaml and Samba function name collisions
We've had recently exactly the same problem with libsmbclient (we even posted it here but no one seemed to have noticed it). The only solution we found yet was to modify the source code of libsmbclient to rename the colliding names (string_set and sys_open). But this is clearly not a good solution.

The #define you suggested does not seem to work and I think this is beacause they are not exported in the header files but are in the the .so and therefore visible in the global C namespace. And I'd prefer not to have to use C++ (I think I should be able to do it in C), so I did not try the namspace trick.

That's why, unless someone has a canonical solution to the problem, I think functions with such common names should have their names prefixed.


Samuel Mimram.


On Tue, 25 Nov 2003 16:52:22 +0900
"Nicolas Cannasse" <warplayer@free.fr> wrote:

> > > 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 will definitely sign this petition. I had a similar problem while
> > trying to write an ocaml binding to the graphviz library. Both the
> > libraries defined, IIRC, a color struct used in graphviz for node colors
> > and in ocaml by the GC :-(
> 
> This is not a primitive name problem, but a data structure one (when
> including file).
> It can be easily resolved by using a #define color caml_color (or the
> working equivalent) before including the caml headers.
> Other solution is to put the caml headers into a C++ namespace.
> BTW I'm not signing this petition : having everything prefixed with caml_ is
> way to heavy. But for theses string_get string_set primitives that's true
> the naming is too much generic and proper to name collision. Only theses
> kinds should be renamed.
> 
> Nicolas Cannasse
> 
> -------------------
> 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


-- 
Samuel Mimram

samuel.mimram@ens-lyon.fr

-------------------
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