Hi,

>> We already have part of this enabled in fm.c, but only 
>> when building core in C++ mode, and if FMSTAT is enabled.
> 
> I tried to activate this part with:
> 
>       @set HB_BUILD_MODE=cpp
>       @set HB_USER_CFLAGS=-DHB_FM_STATISTICS
>       in hbqt.hbc: 
>       from:   
>       {allgcc}libs=supc++
>       to:
>       {allgcc}libs=hbvm supc++ (maybe there are more sophisticated
> approaches to eliminate the double defined new/delete build errors )
> 
> But hbide and demoqt crashes on exit, see below...

This looks a little bit hybrid solution, so I'm 
not confident it's safe to do. For sure duplicates 
on new/delete doesn't look healthy. Speccing 
hbvm as user lib is also not recommended and 
may have side effects.

It'd be better to test it by including source 
below in hbqt lib, and use it with default Harbour 
build.

---
#include "hbapi.h"

void * operator new[]( size_t size )
{
   return hb_xgrab( size );
}

void * operator new( size_t size )
{
   return hb_xgrab( size );
}

void operator delete[]( void * ptr )
{
   hb_xfree( ptr );
}

void operator delete[]( void * ptr, size_t )
{
   hb_xfree( ptr );
}

void operator delete( void * ptr )
{
   hb_xfree( ptr );
}

void operator delete( void * ptr, size_t )
{
   hb_xfree( ptr );
}
---

>> Maybe we should create a small contrib lib with just 
>> that, so that it could be used by any C++ contribs we 
>> may happen to have in the future (plus hbqt of course).
> 
> OK, it is useful I think, but will generate other problems as we can see.
> 
> I just proposed a similar handling of the fm.c mingw build with the MSC
> build.
> More exactly to insert in the subsequent logic the #define USE_DL_PREFIX for
> MinGW. I haven't enough knowledge of the HVM internals to do it, sorry.
> ...
> #  elif defined( _MSC_VER )
> #     if !defined( USE_DL_PREFIX ) && !defined( HB_FM_DLMT_ALLOC )
> #        define USE_DL_PREFIX
> #     endif
> #     if defined( HB_OS_WIN_CE )
> #        define LACKS_FCNTL_H
> #     endif 
> ...
> This part generates the different MSC and MinGW default builds behavior, as
> I understood correctly.

This is less optimal solution, but we already do it for 
MSVC, so we can enable it for MinGW also, if it turns 
out to be the only solution.

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to