<br><font size=2 face="sans-serif">We found an amelioration for the problem
that I described earlier, where our application was segfaulting upon calling
CbcMain1. &nbsp;I'm going to describe it because at least two people on
this list mentioned similar problems.</font>
<br>
<br><font size=2 face="sans-serif">There are two definitions of CbcMain1,
with different calling signatures. &nbsp;One is a three-argument function,
while the other takes four arguments. &nbsp;Our application calls the three-argument
version, which in turn calls the four-argument version. &nbsp;It is the
inner call to the four-argument CbcMain1 that segfaults.</font>
<br>
<br><font size=2 face="sans-serif">Our current theory is that JNI is failing
to keep straight the multiple CbcMain1's in the symbol table. &nbsp;The
problem goes away if you rename the four-argument version, and have the
three-argument version call the renamed function rather than the original.</font>
<br>
<br><font size=2 face="sans-serif">The COIN/OR project should not be responsible
for working around JNI's bugs; but that having been said, it would help
if the two functions called CbcMain1 were given different names.</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">From:</font>
<td><font size=1 face="sans-serif">acw@ascent.com</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font>
<td><font size=1 face="sans-serif">cbc@list.coin-or.org</font>
<tr>
<td valign=top><font size=1 color=#5f5f5f face="sans-serif">Cc:</font>
<td><font size=1 face="sans-serif">dev@ascent.com</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font>
<td><font size=1 face="sans-serif">08/13/2009 05:08 PM</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font>
<td><font size=1 face="sans-serif">[Cbc] Invoking the Cbc solver from a
Java application via JNI.</font></table>
<br>
<hr noshade>
<br>
<br>
<br><font size=2 face="sans-serif"><br>
We have a Cbc application that is invoked from Java using the Java Native
Interface (JNI).</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
We're working under Linux.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
We build a shared-object (.so) library which provides an entry-point very
much like driver4's &quot;main&quot;. &nbsp;This entry works fine when
called straight from C++ code. &nbsp;But when called via JNI it fails in
a weird way. &nbsp;It throws a segmentation fault immediately after entering
the function CbcMain1. &nbsp;I moved debugging statements around the entry
to CbcMain1, and I can't resolve the place the fault is signalled: it looks
like it happens as part of the calling sequence to CbcMain1.</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
A call to CbcMain0, a few lines upstream, completes successfully.</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
Has anyone else succeeded in using Cbc from Java/JNI, and do you have any
advice to offer? &nbsp;I am suspecting that some of the compilation flags
in the Cbc build process violate JNI's expectations about library structure,
but this vague suspicion doesn't explain why CbcMain0 works and CbcMain1
fails.</font><tt><font size=2>_______________________________________________<br>
Cbc mailing list<br>
Cbc@list.coin-or.org<br>
</font></tt><a href="http://list.coin-or.org/mailman/listinfo/cbc"><tt><font size=2>http://list.coin-or.org/mailman/listinfo/cbc</font></tt></a><tt><font size=2><br>
</font></tt>
<br>