o Robert Szokovacs [10/14/09 14:28]:
On 2009 October 14, Wednesday 13:58:23 you wrote:
If your application needed some symbol from session_timer, then there
was something wrong in the use of the module; if you are using it only
via DI API, then there should be no exported symbol necessary. If your
module export is of base type (AmPluginFactory), then I don't

If I load my plugin first:

(21793) DEBUG: [b7d386c0] load (AmPlugIn.cpp:191): loading /usr/local/sems-
szo/lib/sems/plug-in//xxx.so...
(21793) ERROR: [b7d386c0] loadPlugIn (AmPlugIn.cpp:279): AmPlugIn::loadPlugIn: /usr/local/sems-szo/lib/sems/plug-in//xxx.so: /usr/local/sems-
szo/lib/sems/plug-in//xxx.so: undefined symbol: _ZN9UserTimer8setTimerEiiRKSs
(21793) ERROR: [b7d386c0] load (AmPlugIn.cpp:193): while loading plug-in '/usr/local/sems-szo/lib/sems/plug-in//xxx.so'

grep UserT xxx.cpp
#include "plug-in/session_timer/UserTimer.h"
  UserTimer::instance()->setTimer(1,1,tag);
    UserTimer::instance()->setTimer(1,1,getLocalTag());
  UserTimer::instance()->removeTimers(getLocalTag());

that's all I use.
this is not how you are supposed to use the DI interface. the nice thing about DI interface is that you can import the interface without linking to it (i.e. also without #include header files).

Example (from DSMCoreModule.cpp):
  unsigned int timerid = 1;
  unsigned int timeout = 10;
  string event_sink_session_tag = getLocalTag();

  DBG("setting timer %u with timeout %u\n", timerid, timeout);
  AmDynInvokeFactory* user_timer_fact =
    AmPlugIn::instance()->getFactory4Di("user_timer");

  if(!user_timer_fact) {
    ERROR("load sess_timer module for timers.\n");
    return false;
  }
  AmDynInvoke* user_timer = user_timer_fact->getInstance();
  if(!user_timer) {
    ERROR("load sess_timer module for timers.\n");
    return false;
  }

  AmArg di_args,ret;
  di_args.push((int)timerid);
  di_args.push((int)timeout);      // in seconds
  di_args.push(event_sink_session_tag);
  user_timer->invoke("setTimer", di_args, ret);

Its a little more code, but the DI APIs are supposed to be stable, as opposed to the internal functions you are using (and which should actually not even be public).

If you want to have it more efficiently, you can get the user_timer interface instance once and reuse it.

Stefan



Do you think that an explicit order of onLoad() calling is indeed
needed? Something like init_order?

I don't need it, no, see above, I had a linker error.

br

Szo
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

--
Stefan Sayer
VoIP Services

[email protected]
www.iptego.com

IPTEGO GmbH
Wittenbergplatz 1
10789 Berlin
Germany

Amtsgericht Charlottenburg, HRB 101010
Geschaeftsfuehrer: Alexander Hoffmann
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to