[Ns-developers] static ns-3 take two
Gustavo Carneiro
gjcarneiro at gmail.com
Sun Feb 15 05:01:17 PST 2009
I spent a couple of hours trying to get ns-3 static build to work again,
this time with real static libraries. With the attached patch it almost
works, except:
1. Olsr does not work;
2. Python bindings won't build (add --disable-python for now, besides
--enable-static)
3. No all unit tests will run on waf check
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
work because olsr::AgentImpl is declared in a private header file, so I
can't find it. But this is fixable by making that header file public as
well, or something. Not all unit tests run because a similar trick would
need to be applied to unit test classes.
So, the file src/core/typeid-list.cc is generated, containing:
static struct GlobalTypeIdRegistrationClass
{
GlobalTypeIdRegistrationClass ()
{
TypeId tid1 = PacketSocketFactory::GetTypeId (); tid1.GetParent ();
TypeId tid2 = Icmpv4Echo::GetTypeId (); tid2.GetParent ();
[...]
}
}
This file is #included directly from type-id.cc (one .cc file including
another .cc file is legal). This way, the dynamic type registration code
and the dynamic type lookup code both end up in the same compilation unit
(same .o file), and so everything works.
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ns-3-static.diff
Type: text/x-patch
Size: 19241 bytes
Desc: not available
Url : http://mailman.isi.edu/pipermail/ns-developers/attachments/20090215/593a64f8/ns-3-static-0001.bin
More information about the Ns-developers
mailing list