Re: does anyone use java+swig bindings?

Posted by Richard Gomes on
URL: http://quantlib.414.s1.nabble.com/does-anyone-use-java-swig-bindings-tp1326p1330.html

Tito Ingargiola wrote:

>
> Hi Guillaume,
>
> Thanks for responding - that sounds great.
>
> Did you see the example I provided in the original mail?  Can you tell
> me what's wrong with it?  Alternatively, could you provide a sample
> program in java which actually does something useful with Quantlib?
>
> Environment: I'm running on linux (ubuntu desktop and redhat
> enterprise); g++ 4.1.2; java 1.6.0_02; IDEs - emacs & eclipse; latest
> versions of boost, quantlib, and swig.
>
> Many thanks in advance for any help you might provide!  Regards,
>
>     Tito.
>
> */Guillaume Dru <[hidden email]>/* wrote:
>
>     Hi,
>
>     I'm currently working with Java/SWIG/Quantlib, to convert a C++
>     program into Java (by implementing new interfaces (.*)) files.
>     I'll be glad to help you, because I had a lot issues at the beginning .
>     But now, It works great !
>     So if you want some advices or tips, don't hesitate (sorry for my
>     horrible english ...)
>     Could you tell me more about your computer ? (OS, IDE, C++ compiler ...)
>
>     Regards
>
>
>     2007/9/6, Tito Ingargiola <[hidden email]
>     <mailto:[hidden email]>>:
>
>
>         Hi Richard,
>
>         I am hoping to hear that someone is able to use the swig
>         bindings for something non-trivial in java which is clearly more
>         than you or I have (yet!) managed.  I want to see some code that
>         actually works as I'm skeptical that the bindings are functional
>         for java.
>
>         Luigi's response to you seems correct for the case where one
>         wants to access functionality which hasn't yet been mapped in
>         the swig bindings.  My issue is instead one where the swig
>         bindings are defined but they just don't seem to work.  I agree
>         that writing my own JNI stuff wouldn't be fun, but I wouldn't
>         try to map the entire api, just specific questions I might want
>         answered, e.g., the price of an option on a future.  This is a
>         much more constrained issue which isn't so difficult much as I'd
>         prefer to avoid it if the swig stuff can be made to work...
>
>         All of that said, if you have a concrete idea about how we can
>         work together, I'm glad to hear it.  For now, it seems a
>         starting point is to get something simple, like what I'd
>         provided, to work.  I hope someone will be able to point us in
>         the direction of a working example.  (Pretty please! :-)
>
>         Regards,
>
>             Tito.
>
>         ps - I've moved this from the dev to the users list as it seems
>         the more appropriate forum
>
>         */Richard Gomes < [hidden email]
>         <mailto:[hidden email]>>/* wrote:
>
>             Hi Tito,
>
>             I have a lot of code in Java as well and I'd like to plug
>             QuantLib in.
>
>             It's incredible how you and me are facing the same problems,
>             following
>             the same path and started translating the same example! :D
>             When I
>             looked at you Java code it was quite similar to mine (of
>             course... you
>             also translated the example in C++).
>
>             Oh well...
>
>             I dont think that writing your own JNI is a good idea.
>             It's a huge, boring and error prone task. I'd rely on SWIG
>             instead.
>             It'd be much easier to learn how to hack the intrincacies of
>             SWIG.
>
>             It would be great if we were able to convert comments from
>             C++ code to
>             JavaDOC as well, as Eclipse would be able to show
>             documentation as you type.
>
>             Another thing to be considered is performance.
>             I tried to use Matrix and it does not make sense to
>             initialize every
>             cell at a time. The performance will be poor. It means that
>             we should
>             create additional methods intended to be called by another
>             languages due
>             to poor performance of separated calls.
>
>             I've posted one thread quite similiar to yours and Luigi
>             gave me some
>             directions. In case, I've use Matrix as an example of issues
>             I've found.
>
>             I'm planning to work on SWIG this weekend. Maybe we could
>             work together
>             on this kind of thing.
>
>             Kind Regards
>
>             -- Richard Gomes
>
>
>             -------------------------------------------------------------------------
>             This SF.net email is sponsored by: Splunk Inc.
>             Still grepping through log files to find problems? Stop.
>             Now Search log events and configuration files using AJAX and
>             a browser.
>             Download your FREE copy of Splunk now >> http://get.splunk.com/
>             _______________________________________________
>             QuantLib-dev mailing list
>             [hidden email]
>             <mailto:[hidden email]>
>             https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>
>
>
>         -------------------------------------------------------------------------
>         This SF.net email is sponsored by: Splunk Inc.
>         Still grepping through log files to find problems?  Stop.
>         Now Search log events and configuration files using AJAX and a
>         browser.
>         Download your FREE copy of Splunk now >>   http://get.splunk.com/
>         _______________________________________________
>         QuantLib-users mailing list
>         [hidden email]
>         <mailto:[hidden email]>
>         https://lists.sourceforge.net/lists/listinfo/quantlib-users
>         <https://lists.sourceforge.net/lists/listinfo/quantlib-users>
>
>
>
>
>     --
>     Guillaume DRU
>     '' One would normally define a "religion" as a system of
>     ideas that contain statements that cannot be logically or
>     observationally demonstrated... Gödel's theorem not only
>     demonstrates that mathematics is a religion, but shows
>     that mathematics is the only religion that proves itself
>     to be one! ''
>     J. D. Barrow, The World within the world
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users


Hi Guillaume,

Thank you for your offer.

My environment is

AMD64
Kubuntu 7.04
GCC 4.1.2
Java 1.5.12 for AMD64
Java 1.6.0_02 for AMD64 (still evaluating)
Eclipse 3.3 with CDT
Boost 1.33
Quantlib 0.8.1
QuantLib-SWIG 0.8.0

In spite it's AMD64, everyting is working fine. :)
What is not working fine, I'm sure it's *my* ignorance about QuantLib.

Thanks

-- Richard Gomes


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users