<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<font face="Courier 10 Pitch">Ahh, thanks Norman, it was the combination
of LIBS += stdcxx and #include <new> that I was looking for.<br>
<br>
Daniel<br>
<br>
</font>
<div class="moz-cite-prefix">On 03/20/2013 12:46 AM, Norman Feske
wrote:<br>
</div>
<blockquote cite="mid:51496958.4090006@...1..." type="cite">
<pre wrap="">Hello Daniel,
</pre>
<blockquote type="cite">
<pre wrap="">[...] how do I use the std c++ new placement
operator which take void *, i.e.
void * p = ::malloc(256);
T * obj = new (p) T();
When I try to use this it cannot find the operator, only the Genode
allocator version. I have 'cxx' in my target.mk
</pre>
</blockquote>
<pre wrap="">
in the rare cases where the Genode base system needs a placement new
operator, we host it in the implementation file. For example,
'base/src/base/allocator/slab.cc' contains one. This way, the operator
is defined only if really intended, which avoids using it by accident.
It is a single line of code:
inline void *operator new(size_t, void *at) { return at; }
Alternatively, if you are using the standard C++ library anyway, you may
use the definition provided by libsupc++. Just specify your LIBS
declaration in your 'target.mk' file as follows:
LIBS = libc libm stdcxx
Now, you can just '#include <new>' and use the placement new operator
provided there.
Cheers
Norman
</pre>
</blockquote>
<br>
</body>
</html>