[Botan-devel] Re: botan-devel Digest, Vol 13, Issue 10
carlton at cs.mcgill.ca
Fri Dec 16 17:35:50 EST 2005
Please see the message below.
> On Thu, Dec 15, 2005 at 03:59:09PM -0500, Carlton Davis wrote:
> > Jack,
> > I tried putting the following code
> > Init::initialize();
> > Init::deinitialize();
> > in the simulator startup
> > and shutdown code, respectively as you suggested,
> > but as I anticipated, botan is still throwing the
> > Invalid_State exception.
> > Perhaps I should ask if it is necessary to initialize the
> > botan library before botan variables are declared?
> Declared, no. Constructed, yes. That exception is thrown because somewhere some
> Botan object is trying to get access to a resource that is global to the
> library (typically, the memory pool), and it just found out that nothing is
> there yet.
> > If the answer to this question is yes, then with the simulator
> > I am using (NS2 network simulator), if I initialize the
> > botan library in the constructor for the agent (the protocol),
> > this won't cause the initialization of botan in the included
> > header file. It is hard to explain in a few words; but essentially,
> > I don't have access to all the simulation code in C++ because
> > the front-end of the simulator is written in octl.
> Hmm... well, I admit that I'm still not quite sure what is going on, but I
> suppose that's hardly unusual for me. If it really is impossible to get some
> C++ hooks executed during process initialization time, the simplest thing that
> comes to mind is everywhere you need a global Botan object, keep a pointer to
> it instead, and dynamically allocate it after you've had a chance to initialize
> the library.
I am actually able to get the simulator to execute C++ code
during the simulation initialization time. I indicated that the
first thing I want to do (before any other C++ code is
executed) is to execute the following line:
Similarly, I directed it to execute "Init::deinitialize()"
as the last line of C++ code.
The "Init::initialize()" line get executed but it is still
throwing the Botan Invalid_State exception, ie I got the following
what(): Botan: LibraryInitializer not created, or it failed"
What am I doing incorrect here?
Your help is greatly appreciated.
More information about the botan-devel