You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Jared Hanson <ja...@gmail.com> on 2007/02/16 19:43:36 UTC

axis2c static deployment engine

I'm following up in regard to the static deployment engine I mentioned in my
email yesterday.

There is a change in the trunk, which removed the ops struct from dll_desc.
My static deployment engine was taking advantage of that, combined with the
function macros, as a sort of virtual function table, in a similar manner to
what you could accomplish with virtual functions and C++ subclasses.

Specifically, in class_loader.c's axis2_class_loader_create_dll() method.

It calls, dl_handler = AXIS2_DLL_DESC_GET_DL_HANDLER(dll_desc, env) to see
if the library has been loaded, followed by  create_funct =
AXIS2_DLL_DESC_GET_CREATE_FUNCT(dll_desc, env) to instantiate instances.  If
GET_DL_HANDLER returns NULL, it loads the DLL and calls set_create_func and
set_delete_func.  It was also operating on the ops structure in 0.95, but in
the trunk, the ops structure has been removed, and the function macros just
call functions directly.

0.95:
#define AXIS2_DLL_DESC_GET_DL_HANDLER(dll_desc, env) \
    ((dll_desc)->ops->get_dl_handler(dll_desc, env))

trunk:
#define AXIS2_DLL_DESC_GET_DL_HANDLER(dll_desc, env) \
    axis2_dll_desc_get_dl_handler(dll_desc, env)


In the case of the static deployment engine, the static conf_builder and and
svc_builder were creating instances of as_axis2_dll_desc_create (the static
equivalent of the dll_desc).  class_loader required no modifications, and
because of the ops struct, it would call methods on the as_axis2_dll_desc
(which is implemented by as_axis2_dll_desc_get_dl_handler, etc)

For example, as_axis2_dll_desc_get_dl_handler always returns non-NULL, since
by definition a library static linked is already loaded.  Then,
as_axis2_dll_desc_get_create_funct calls into an as_static_repos object to
get a procedure address, rather than calling a function on a DLL loaded from
disc.

Now, I can work around this by doing something like the following:

#ifdef AXIS2_DECLARE_STATIC
#define AXIS2_DLL_DESC_GET_DL_HANDLER(dll_desc, env) \
    as_axis2_dll_desc_get_dl_handler(dll_desc, env)
#else
#define AXIS2_DLL_DESC_GET_DL_HANDLER(dll_desc, env) \
    axis2_dll_desc_get_dl_handler(dll_desc, env)
#endif


However, I think the virtual functions provided by the ops structure was
very flexible, especially in the case of having both static and dynamic
deployment options.

Hopefully that description explains the issue well enough.  I was wondering
what the rationale was for getting rid of the ops struct?  I know my static
deployment engine code isn't public, so my issues aren't a concern to the
group.  However, I think the static option is worthwhile, and I am willing
to contribute that code.  So, if the project finds it valuable, it may be
worth putting the ops struct back in.

If there are any questions, please ask.

Thanks,
Jared