<div>It is getting pretty hard to compile with C#, as C# doesn't have as good support with SWIG. There are two problems here - one is that some of the new code that I added for Python (which is currently the principal target) doesn't work on C#, as SWIG for C# doesn't handle some of the templates - I'll try to fix that (by #ifdef'ing out the code which doesn't work for C#...)</div>
<div> </div>
<div>The other problem is that SWIG wasn't generating code which wouldn't compile without modifying.</div>
<div>I think I did get some code compiling under C# last time some one asked about it, but it wasn't easy. </div>
<div> </div>
<div>As to the GC problem, at least on python you set filterManager.thisown = False, and this means it won't be GC'ed. Not sure if SWIG has the same thing for C#.</div>
<div><br>God Bless,<br>Ben<br>-------------------------------------------------------------------------------------------<br>Multitudes, multitudes,<br> in the valley of decision!<br>For the day of the LORD is near<br>
in the valley of decision.<br><br>Giôên 3:14 (ESV)</div>
<div><span class="gmail_quote">On 22/08/2009, <b class="gmail_sendername">Wade Balzer</b> <<a href="mailto:wbalzer@newjerusalem.org">wbalzer@newjerusalem.org</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div lang="EN-US" vlink="purple" link="blue">
<div>
<p><span style="COLOR: #1f497d">That was the biggest problem I had was trying to regenerate the wrapper.</span></p>
<p><span style="COLOR: #1f497d"> </span></p>
<p><span style="COLOR: #1f497d">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.</span></p>
<p><span style="COLOR: #1f497d"> </span></p>
<p><span style="COLOR: #1f497d">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. :-(</span></p>
<p><span style="COLOR: #1f497d"> </span></p>
<p><span style="COLOR: #1f497d">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.</span></p>
<p><span style="COLOR: #1f497d"> </span></p>
<p><span style="COLOR: #1f497d">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.</span></p>
<p><span style="COLOR: #1f497d"> </span></p>
<p><span style="COLOR: #1f497d">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.</span></p>
<p><span style="COLOR: #1f497d"> </span></p>
<p><span style="COLOR: #1f497d">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.</span></p>
<p><span style="COLOR: #1f497d"> </span></p>
<p><span style="COLOR: #1f497d">Thanks,</span></p>
<p><span style="COLOR: #1f497d"> </span></p>
<p><span style="COLOR: #1f497d">Wade</span></p>
<p><span style="COLOR: #1f497d"> </span></p>
<div>
<div style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<p><b><span style="FONT-SIZE: 10pt">From:</span></b><span style="FONT-SIZE: 10pt"> Jeff Becker [mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:jbecker@fiveviews.com" target="_blank">jbecker@fiveviews.com</a>] <br>
<b>Sent:</b> Friday, August 21, 2009 11:11 AM<br><b>To:</b> SWORD Developers' Collaboration Forum<br><b>Subject:</b> Re: [sword-devel] .Net Exception Odd behavior...</span></p></div></div>
<div><span class="e" id="q_1233e5bb3832654f_1">
<p> </p>
<div>
<p><span style="FONT-SIZE: 10pt; COLOR: blue">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 dll.</span><span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'"></span></p>
</div>
<div>
<p><span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'"> </span></p></div>
<div>
<p><span style="FONT-SIZE: 10pt; COLOR: blue">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.</span><span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'"></span></p>
</div>
<blockquote style="MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt; MARGIN-RIGHT: 0in">
<p style="MARGIN-BOTTOM: 12pt"><span style="FONT-SIZE: 10pt">-----Original Message-----<br><b>From:</b> Wade Balzer [mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:wbalzer@newjerusalem.org" target="_blank">wbalzer@newjerusalem.org</a>]<br>
<b>Sent:</b> Friday, July 31, 2009 11:42 AM<br><b>To:</b> <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br><b>Subject:</b> [sword-devel] .Net Exception Odd behavior...</span><span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'"></span></p>
<p>I am working on a Bible project in C# for the web. I am using the SwigSword.dll wrapper.</p>
<p> </p>
<p>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.</p>
<p> </p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">filterManager = <span style="COLOR: blue">new</span> <span style="COLOR: #2b91af">MarkupFilterMgr</span>((<span style="COLOR: blue">char</span>)<span style="COLOR: #2b91af">Sword</span>.FMT_OSIS, (<span style="COLOR: blue">char</span>)<span style="COLOR: #2b91af">Sword</span>.ENC_HTML);</span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">manager = <span style="COLOR: blue">new</span> <span style="COLOR: #2b91af">SWMgr</span>( filterManager);</span></p>
<p> </p>
<p><span style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'">GC</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">.SuppressFinalize(filterManager);</span></p>
<p> </p>
<p>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% variable.</p>
<p> </p>
<p>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 CRASHES.</p>
<p> </p>
<p><span style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'">SWConfig</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> config = <span style="COLOR: blue">new</span> <span style="COLOR: #2b91af">SWConfig</span>(BaseModDir + <span style="COLOR: #a31515">"mods.d\\global.conf"</span>);</span></p>
<p><span style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'">SWConfig</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> sysconfig = <span style="COLOR: blue">null</span>;</span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> </span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">filterManager = <span style="COLOR: blue">new</span> <span style="COLOR: #2b91af">MarkupFilterMgr</span>((<span style="COLOR: blue">char</span>)<span style="COLOR: #2b91af">Sword</span>.FMT_OSIS, (<span style="COLOR: blue">char</span>)<span style="COLOR: #2b91af">Sword</span>.ENC_HTML);</span></p>
<p><span style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">//manager = new SWMgr( filterManager);</span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">manager = <span style="COLOR: blue">new</span> <span style="COLOR: #2b91af">SWMgr</span>(config, sysconfig, <span style="COLOR: blue">false</span>, filterManager);</span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">manager.configPath = BaseModDir + <span style="COLOR: #a31515">"mods.d\\"</span>;</span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">manager.prefixPath = BaseModDir;</span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">manager.Load();</span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> </span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">manager.augmentModules(BaseModDir);</span></p>
<p><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> </span></p>
<p><span style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'">GC</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">.SuppressFinalize(filterManager);</span></p>
<p> </p>
<p>I am not sure why the first one works without a problem, and the second one works, but crashes on exit.</p>
<p> </p>
<p>HELP!!!</p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p>Wade</p>
<p> </p>
<p> </p></blockquote></span></div></div></div><br>_______________________________________________<br>sword-devel mailing list: <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>Instructions to unsubscribe/change your settings at above page<br>
</blockquote></div><br><br clear="all"><br>