[sword-devel] .Net Exception Odd behavior...

Wade Balzer wbalzer at newjerusalem.org
Fri Aug 21 12:05:53 MST 2009

That was the biggest problem I had was trying to regenerate the wrapper.


I compile all the latest updates successfully in VS C++ 2008, but I can't
get SWIG to regenerate the wrapper for C#.  So I have been using an older
version of the compiled binary that is buggy.


The latest version of SWIG does have fixes and better handling, but I can't
get it to compile.  Ugh.  Apparently,  the latest updates to the header
library were targeted to a PHP target leaving a C# target broken.  :-(


So. because I couldn't get it working, I  started to create my own modules
from an OSIS source.  I was going to parse out the modules and place them on
a SQL Server, but my tests have been slow searching through an unindexed
field. (2 minutes to search for a single word using a CLR Regex function.
Yuck.)   At least with a map of an OSIS document, I can locate each verse
and traverse all the verses in the bible in under 5 seconds.  If I create a
binary index, I can return all occurrences of God in less than a second.


I think I still would rather use the SWORD Library because it is faster on
searches, and has more people involved in updating the core library.


My only other option was to create a native C# Sword Library, but I don't
have the time or energy to recreate the wheel.


If anyone can help by taking the latest code base, and recompile a working
SwigSword.dll targeted for C# and accompanying dll's, that would be very
helpful.  Let me know how you got it working would cool too.






From: Jeff Becker [mailto:jbecker at fiveviews.com] 
Sent: Friday, August 21, 2009 11:11 AM
To: SWORD Developers' Collaboration Forum
Subject: Re: [sword-devel] .Net Exception Odd behavior...


It could be the same problem I ran into some time back.  The SwigSword code
destroys some pointers then tries to use them again.  Under .Net 1.0 it
wasn't a problem because the error was ignored.  Under .Net 2.0 it raises an
error and crashes the calling application.  In my case it was MS Word since
I was working on an Add-In but it would probably crash anything calling the


I'm hoping that Swig has fixed the .Net 2.0 pointer issue.  If that's the
case then the easiest approach might be to regenerate the wrapper.  I'm
guessing that the problem isn't in just one property or method since the
code relatively consistent throughout.

-----Original Message-----
From: Wade Balzer [mailto:wbalzer at newjerusalem.org]
Sent: Friday, July 31, 2009 11:42 AM
To: sword-devel at crosswire.org
Subject: [sword-devel] .Net Exception Odd behavior...

I am working on a Bible project in C# for the web.  I am using the
SwigSword.dll wrapper.


When I load the manager using the default location for the modules as
provided by the SWORD_PATH environment, it words fine and the debugger exits
without a problem.


filterManager = new MarkupFilterMgr((char)Sword.FMT_OSIS,

manager = new SWMgr( filterManager);




However since this will be a web environment, I need to directly point to
the Module locations without directly pointing to my local %SWORD_PATH%


When I set the location of the config, and manually set the location of the
module path, everything seems to work fine until I exit the debugger.  It


SWConfig config = new SWConfig(BaseModDir + "mods.d\\global.conf");

SWConfig sysconfig = null;


filterManager = new MarkupFilterMgr((char)Sword.FMT_OSIS,

//manager = new SWMgr( filterManager);

manager = new SWMgr(config, sysconfig, false, filterManager);

manager.configPath = BaseModDir + "mods.d\\";

manager.prefixPath = BaseModDir;







I am not sure why the first one works without a problem, and the second one
works, but crashes on exit.









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20090821/4222ddc1/attachment.html>

More information about the sword-devel mailing list