[Tizen Application-dev] tizen native development - global operator new / delete override issue

Nick Dodonov nick.dodonov at gmail.com
Fri Jun 14 18:33:47 GMT 2013


Hi All,

The problem (and sample) in details is described on forum:
https://developer.tizen.org/forums/native-application-development/cant-replace-global-operator-new-and-delete

In short: global new/delete operators overriding behave differently when
application is executed with a debugger or just launched (by tap f.e.).

With further researches I've got:

* When application is executed with a debugger
- it's executed as a separate process.
- `sdb shell pmap <pid>` gives info that executable is loaded *first*
before any dynamic library.
- run-time dynamic linker correctly resolves undefined/weak symbols from
loaded dynamic libraries to my executable, so symbols just
like _Znwj/_ZdlPv/etc (operator new/delete/etc) correctly resolved to my
implementation.
- OspMain is called after everything is loaded via
'libosp-appfw.so.1.2.1.0'/FApp_AppEntry.cpp/main()
- all works correctly!

* When application is just launched
- it is executed as fork()
of /usr/bin/launchpad_preloading_preinitializing_daemon
- `pmap` for 'launchpad' gives that it's already loaded every platform's
dynamic library, so all their undefined/weak symbols are possibly already
resolved.
- forked launchpad's uiapp_loader.c/main() loads my executable via dlopen()
(so it became *last* loaded in pmap) and calls OspMain

So in launch mode, in case executable uses code like this:
SomeLibraryClass* p = new SomeLibraryClass();
delete p;

'operator new' is called from executable, but 'operator delete' from
libstdc++ (because gcc compiler puts 'operator delete' invocation into
destructor's implementation).

So question now is: Is it possible to override global operator new/delete
in Tizen native application?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tizen.org/pipermail/application-dev/attachments/20130614/89a1596c/attachment.html>


More information about the Application-dev mailing list