[Cbc] Invoking the Cbc solver from a Java application via JNI.
acw at ascent.com
acw at ascent.com
Wed Sep 9 16:44:09 EDT 2009
We found an amelioration for the problem that I described earlier, where
our application was segfaulting upon calling CbcMain1. I'm going to
describe it because at least two people on this list mentioned similar
problems.
There are two definitions of CbcMain1, with different calling signatures.
One is a three-argument function, while the other takes four arguments.
Our application calls the three-argument version, which in turn calls the
four-argument version. It is the inner call to the four-argument CbcMain1
that segfaults.
Our current theory is that JNI is failing to keep straight the multiple
CbcMain1's in the symbol table. 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.
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.
From:
acw at ascent.com
To:
cbc at list.coin-or.org
Cc:
dev at ascent.com
Date:
08/13/2009 05:08 PM
Subject:
[Cbc] Invoking the Cbc solver from a Java application via JNI.
We have a Cbc application that is invoked from Java using the Java Native
Interface (JNI).
We're working under Linux.
We build a shared-object (.so) library which provides an entry-point very
much like driver4's "main". This entry works fine when called straight
from C++ code. But when called via JNI it fails in a weird way. It
throws a segmentation fault immediately after entering the function
CbcMain1. 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.
A call to CbcMain0, a few lines upstream, completes successfully.
Has anyone else succeeded in using Cbc from Java/JNI, and do you have any
advice to offer? 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._______________________________________________
Cbc mailing list
Cbc at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/cbc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/cbc/attachments/20090909/c77d1abb/attachment.html
More information about the Cbc
mailing list