[sword-devel] running swmgrex.cpp - Sword API 1.5.7 under Windows/MS VC 7.1 - a couple of minor fixes

John Lobaugh j_lobaugh at yahoo.com
Sat Dec 4 18:27:34 MST 2004


Hello,

I had a couple of problems running swmgrex.cpp in the example directory.
Here is what I did to fix things up in case anyone is interested...

1. 
If you don't have a mods.conf or mods.d directory in the same directory as the
executable  the example will crash on line 36 of swmgrex.cpp because there are
no modules loaded in the manager. The fix is to wrap lines 36 - 50 with 

if ( manager.Modules.begin() != manager.Modules.end() )
{
   [ lines 36 - 50 ]
}


2. 
Once I got a mods.d directory in place so that the manager had some modules I
had a further problem. I got a run-time error because the variable "pos" was
used without being initialized on line 856 in the procedure CreateMod() of the
SWMgr class. MS-VCPP is little more picky about using uninitialized variables
than gcc, I guess. Since it is being used as a boolean variable initialzing it
to 0 on line 818 fixes the problem without introducing any side-effects.

John Lobaugh


=====
Help free a prisoner of conscience! http://www.amnesty.org/
Write an urgent appeal! http://www.amnesty.ca


More information about the sword-devel mailing list