[Ns-developers] static ns-3 take two

Gustavo Carneiro gjcarneiro at gmail.com
Mon Feb 16 03:46:18 PST 2009


2009/2/16 Mathieu Lacage <mathieu.lacage at sophia.inria.fr>

> On Sun, 2009-02-15 at 14:12 +0000, Gustavo Carneiro wrote:
> >
> >
> > 2009/2/15 Mathieu Lacage <mathieu.lacage at sophia.inria.fr>
> >         On Sun, 2009-02-15 at 13:01 +0000, Gustavo Carneiro wrote:
> >
> >         > The trick is to generate a source file that registers all
> >         known object
> >         > typeids.  The available object typeids are discovered by a
> >         simple regexp
> >         > scanning of the ns-3 public header files.  For this reason,
> >         olsr does not
> >
> >
> >         can't you grep for uses of NS_OBJECT_ENSURE_REGISTERED in
> >         source files ?
> >
> > It does not help with the olsr problem.   Even if I can detect
> > olsr::AgentImpl exists, I cannot call olsr::AgentImpl::GetTypeId
> > because it is not declared in a public header.  Unless you know a way
> > to forward-declare class static methods?
>
>
> We could modify the macro to define a per-type function you can call,
> but, really I was expecting that you would use a set of
> -Wl,--undefined=x_XXXRegistrationVariable command-line options.


I tried:

-Wl,--undefined=x_DefaultSimulatorImplRegistrationVariable
-Wl,--undefined=ns3::x_DefaultSimulatorImplRegistrationVariable
-Wl,--undefined=_ZN3ns3L42x__DefaultSimulatorImplRegistrationVariableE

Neither makes any difference.  In any case with that we start to enter
platform/tool-specific behavior, which reduces portability.  My previous
approach is more work but at least plays by common rules.  But thanks for
the suggestion.

Next thing I'll try (maybe next weekend), will be to modify
NS_OBJECT_ENSURE_REGISTERED to declare a function.  OTOH I'm not too fond of
regexp-scanning the entire set of ns-3 .cc files for every build :-/

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list