NetBSD-Help archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: free in C++?



* James K. Lowden:
> Is malloc_options supposed to work in C++?  I have this message:

Probably, operator new/delete will in all likelyhood call malloc/free 
eventually, but keep in mind that it's possible to overload these.

> The free manpage indicates this is a libc diagnostic.  Trying to follow
> directions, I put 
>
>       extern char *malloc_options;

The manpage calls for _malloc_options. Note the leading underscore. Also,
since you're calling this from C++, you will need to explicitly tell
it to use C linkage. This is not a NetBSD issue, but a C-vs-C++ issue.

try

extern "C" char *_malloc_options;
char *_malloc_options = "X";

This works for me; at least "J" does what it's supposed to do.

-- 
Martijn van Buul - pino%dohd.org@localhost 




Home | Main Index | Thread Index | Old Index