[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Igraph with JNI
Re: [igraph] Igraph with JNI
Tue, 28 Jul 2009 15:15:51 -0400
Internet Messaging Program (IMP) H3 (4.2)
Also if you could provide me with some of your proof-of-concept code
that will be great.
I am pretty decent with Java but I haven't been working with C for a
Quoting Tamas Nepusz <address@hidden>:
I am thinking about trying to bridge igraph with JAVA via JNI on
windows. The way how JNI works is to link Java via JNI to native C
functions. The C source is complied to a shared library DLL file.
Yes, I tried it once, but only as a proof-of-concept, so I pretty
much abandoned the project after I convinced myself that igraph
could be used from Java using JNI had someone took the effort to
develop a proper interface. So yes, it's pretty much doable, but not
straightforward at all. The reason is twofold: first, using JNI
means that you have to write a lot of "glue code" between igraph and
Java (pretty much all igraph data types must have a Java counterpart
and you have to write the conversion code in C); second, there are
some calling conventions in igraph that cannot be easily reproduced
in Java (i.e., functions using additional arguments to _return_
results). I started adapting the interface generator we use to build
the R interface to be able to generate C glue code for the Java
interface, but it's very far from being finished.
Does anyone have worked on this before?
where the The directory after the -I switch is the one containing
the igraph.h file, while the one following -L should contain the
library file itself, usually a file called libigraph.so,
libigraph.a or igraph.dll
I don't know for sure (that's Gábor's part), but I guess nowhere.
The thing is that there are two ways to include igraph in your
project: static linking (in which case you don't need the igraph DLL
as everything that's in the DLL is built directly into your
application) or dynamic linking (where you need the DLL as your app
contains only references to igraph calls). I think the R interface
is built statically, so you won't find a DLL there. JNI only
supports dynamic linking, so you need the DLL. To build the DLL, you
have to build the library from the C source code either in Visual
Studio or in MSYS.
Where actually I can find this igraph.dll in the igraph R package.
So my question is if I compile a c file using igraph librarys, and
it can be compiled successfully, will it be able to run standalone?
If you link it statically, it will work. If you link it dynamically,
it will require the DLL. See the corresponding Wikipedia entries as
a starting point:
Bioinformatics training track
Program in Biomedical Sciences
University of Michigan, Ann Arbor
MI, 48105, U.S.A.
Re: [igraph] Igraph with JNI, Gang Su, 2009/07/28
Re: [igraph] Igraph with JNI, Jose Quesada, 2009/07/28
Re: [igraph] Igraph with JNI, Gábor Csárdi, 2009/07/28