Hi,
This patch moves the call of the initialize() function
into the peer class
constructor body. Before this patch, the call was made
by generated
..._jaceCreateInstance() function, immediately after
the peer object construction. I think
that the proper place of the object initialization code
is the
constructor. The other advantage of this method that
the C++ peer object can
not stay in the memory when an exception occured during
initialize().
I think that the proper place of the object destruction
code is the
destructor. I have moved the call of the destroy() into
the peer destructor body.
The advantage is that the C++ peer object destruction
code will be
run (and frees all the allocated resources)
independently of the VM shutdown. In this case we do
not have to worry about the finalize() call, that maybe
never gets called.
After the patch, the initialize() and destroy() will
not be virtuals. When the
user writes his/her own implementation it will hide the
implementation of
ancestor member functions in the Peer class. If the
user does not overwrite
these functions, the ancestor (empty) implementation
will be run. This method
avoids virtual function call problems during construction.
BR,
Filyó Zoltán
Logged In: YES
user_id=1069986
Sorry I forgot the "JACE_API" in front of the initialize and
destroy functions. This mistake prevents the use of this
functions from outside of the dynamic library.
The right lines:
JACE_API void initialize();
and
JACE_API void destroy();
Filyó Zoltán