caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* C++ & Caml: name clash
       [not found] <38FC05D8.61652265@in.ot.com.au>
@ 2000-04-18  8:08 ` Ohad Rodeh
  2000-04-19 15:50   ` John Max Skaller
  2000-04-19 17:40   ` Xavier Leroy
  0 siblings, 2 replies; 3+ messages in thread
From: Ohad Rodeh @ 2000-04-18  8:08 UTC (permalink / raw)
  To: caml-list

Hello,
  First of all, I'd like to thank all the replies for my
first question. 
 
  My second problem has to do with a name clash between 
the g++ standard library, and the alloc.h file from Caml. 
It turns out that the function "alloc" is defined by g++
in file /usr/include/g++-2/stl_alloc.h as:
	typedef class __default_alloc_template<true,0> alloc
In caml it is defined in include/alloc.h as:
	value alloc(mlsize_t, tag_t) 

  This does not allow compiling a file that #includes both 
Caml and g++ header files. 

  A simple solution is to recompile the Caml distribution
with a compiler flag that will modify alloc to, say, caml_alloc. 
However, I will need to distribute, along with my code, a
different version of Caml. Since this code is included in a much
larger software distribution (Ensemble), this is not an option.

  What do you suggest? 

  Thanks, 
	Ohad.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C++ & Caml: name clash
  2000-04-18  8:08 ` C++ & Caml: name clash Ohad Rodeh
@ 2000-04-19 15:50   ` John Max Skaller
  2000-04-19 17:40   ` Xavier Leroy
  1 sibling, 0 replies; 3+ messages in thread
From: John Max Skaller @ 2000-04-19 15:50 UTC (permalink / raw)
  To: Ohad Rodeh; +Cc: caml-list

Ohad Rodeh wrote:
> 
> Hello,
>   First of all, I'd like to thank all the replies for my
> first question.
> 
>   My second problem has to do with a name clash between
> the g++ standard library, and the alloc.h file from Caml.
> It turns out that the function "alloc" is defined by g++
> in file /usr/include/g++-2/stl_alloc.h as:
>         typedef class __default_alloc_template<true,0> alloc
> In caml it is defined in include/alloc.h as:
>         value alloc(mlsize_t, tag_t)
> 
>   This does not allow compiling a file that #includes both
> Caml and g++ header files.

All parts of the C++ library reside in namespace 'std'.
If there is a clash, it is a g++ bug.


-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C++ & Caml: name clash
  2000-04-18  8:08 ` C++ & Caml: name clash Ohad Rodeh
  2000-04-19 15:50   ` John Max Skaller
@ 2000-04-19 17:40   ` Xavier Leroy
  1 sibling, 0 replies; 3+ messages in thread
From: Xavier Leroy @ 2000-04-19 17:40 UTC (permalink / raw)
  To: Ohad Rodeh, caml-list

>   My second problem has to do with a name clash between 
> the g++ standard library, and the alloc.h file from Caml. 
> It turns out that the function "alloc" is defined by g++
> in file /usr/include/g++-2/stl_alloc.h as:
> 	typedef class __default_alloc_template<true,0> alloc
> In caml it is defined in include/alloc.h as:
> 	value alloc(mlsize_t, tag_t) 
> 
>   This does not allow compiling a file that #includes both 
> Caml and g++ header files. 

The easiest solution, it seems, would be to split your source in two
files, one in plain C (or perhaps C++ but not using the STL)
containing just the Caml wrappers for your functions, and another one
defining your functions in C++ with STL without reference to the Caml
include files.

Hope this helps,

- Xavier Leroy



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-04-19 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <38FC05D8.61652265@in.ot.com.au>
2000-04-18  8:08 ` C++ & Caml: name clash Ohad Rodeh
2000-04-19 15:50   ` John Max Skaller
2000-04-19 17:40   ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).