Re: calendar problem when calling quantlib lib from java

Posted by moloko on
URL: http://quantlib.414.s1.nabble.com/calendar-problem-when-calling-quantlib-lib-from-java-tp5595p5608.html

Hi Luigi,

I first would like to know if it's coming from JNI or from my QL installation.
That's why I've open anoer post about it

gcc -Wall  -I/usr/local/include/ql -o test.o -c test.cpp
gcc -o test -L/usr/local/lib -lQuantLib test.o

./test: error while loading shared libraries: libQuantLib-0.8.1.so: cannot open shared object file: No such file or directory

here is the test.cpp code
--------------------------------------
// the only header you need to use QuantLib
#define BOOST_LIB_DIAGNOSTIC
#  include <ql/quantlib.hpp>
#undef BOOST_LIB_DIAGNOSTIC

#ifdef BOOST_MSVC
/* Uncomment the following lines to unmask floating-point
   exceptions. Warning: unpredictable results can arise...

   See http://www.wilmott.com/messageview.cfm?catid=10&threadid=9481
   Is there anyone with a definitive word about this?
*/
// #include <float.h>
// namespace { unsigned int u = _controlfp(_EM_INEXACT, _MCW_EM); }
#endif

#include <boost/timer.hpp>
#include <fstream>
#include <iostream>
#include <iomanip>


using namespace QuantLib;
using namespace std;

#if defined(QL_ENABLE_SESSIONS)
namespace QuantLib {

    Integer sessionId() { return 0; }

}
#endif

int main(int, char* []) {

   
  FILE * File;
        File = fopen ("toto.txt","w");
        Calendar calendar = UnitedStates();


        fclose (File);
        return 1;
   
}
-----------------------------------

About my JNI function, the problem is it's too connected my all my processes.

Btw, I've re-installed the boost library and I've still the problem.

I think if first I'm able to run my test file, it will be a big step for me ( I've no problem
with test.cpp with VC Express )

Pierre

Luigi Ballabio wrote
On Wed, 2008-02-06 at 00:45 -0800, moloko wrote:
> I've got
> #include <jni.h>
>
> and
> JNIEXPORT jboolean JNICALL
> Java_com_ffm_marketData_calculation_QuantLibCalculation_
> (JNIEnv *env, jobject obj, jstring logFileName, jint max_days, jintArray
> or_array){
>
> and inside the function
> I'm calling "Calendar calendar = UnitedStates();" and other QL functions.

Pierre,
        are you allowed to post the code of your function? If not, maybe you
might strip it down to a simpler version that still triggers the error,
but doesn't give away any proprietary stuff?

Later,
        Luigi


--

So little done, so much to do.
-- Cecil Rhodes



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-users mailing list
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users