<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: jni.h in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909345#M83048</link>
    <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/342379"&gt;ArturGuzik&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Veit,&lt;BR /&gt;&lt;BR /&gt;I don't want to discourage you but before starting a (considerable) effort of translating jni.h header read &lt;A href="http://software.intel.com/en-us/forums/showpost.php?p=12912"&gt;this excellent article by Lorri Menard&lt;/A&gt;. The risk is that your translation will be valid for specific version only, as every new Java comes with new header.&lt;BR /&gt;&lt;BR /&gt;A.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Hello Artur,&lt;BR /&gt;&lt;BR /&gt;I know that Article and also the basing one from Chris Andersson with the nice sample of transient Heat Transfer.&lt;BR /&gt;My hope is to save an additional function call (in the app I'm working on I've at least 30000 calls). Pretty sure that combining Intel C++ and Fortran Compilers will inline the fortran functions but I'm not really happy with licensing the C++ Compiler only for some wrapping functions.&lt;BR /&gt;And I doubt that the GNU C++ compiler is able to inline the fortran code (I did not play around much but in the first try I got two dll's - the used makefile for the Anderson sample is attached).&lt;BR /&gt;But of course the effort is not neglectable to save a function call only - I've to do some tests first if it is worth the work.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Makefile:&lt;BR /&gt;CCFLAGS = -O -shared -Wl,--kill-at,--add-stdcall-alias&lt;BR /&gt;CPPDEFINES = -D __FORTRAN_BUILD__ -D __cplusplus&lt;BR /&gt;FFLAGS1 = -O -dll&lt;BR /&gt;FFLAGS2 = -O -shared -fno-underscoring&lt;BR /&gt;FC  = ifort&lt;BR /&gt;FFLAGS = $(FFLAGS1)&lt;BR /&gt;&lt;BR /&gt;IDIRS = -I/include/java -I/lib/gcc/mingw32/3.4.5/include/gcj&lt;BR /&gt;CCLIBS = &lt;BR /&gt;&lt;BR /&gt;OFILES = tempCalcRoutines.dll&lt;BR /&gt;OBJ = tempCalcRoutines.obj&lt;BR /&gt;OLIB = tempCalcRoutines.lib&lt;BR /&gt;&lt;BR /&gt;libTempCalcJava.obj : $(OFILES) &lt;BR /&gt; g++ $(CCFLAGS) -o TempCalcJava.dll $(OFILES) $(CPPDEFINES) $(CCLIBS) $(IDIRS) TempCalcJava.cpp&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;tempCalcRoutines.dll : tempCalcRoutines.f &lt;BR /&gt; $(FC) $(FFLAGS) tempCalcRoutines.f -o tempCalcRoutines.dll&lt;BR /&gt;&lt;BR /&gt;clean:&lt;BR /&gt; rm -f *.dll&lt;BR /&gt; rm -f *.obj&lt;BR /&gt; rm -f *.so&lt;BR /&gt; rm -f *.lib&lt;BR /&gt; rm -f *.exp&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 29 Jul 2009 03:54:37 GMT</pubDate>
    <dc:creator>veitner</dc:creator>
    <dc:date>2009-07-29T03:54:37Z</dc:date>
    <item>
      <title>jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909343#M83046</link>
      <description>Hello Forum,&lt;BR /&gt;&lt;BR /&gt;also it is possible to produce a mixed language library to interface a library from java I would prefer to use fortran only. Therefore I would like to start to translate the jni.h header into a fortran module and host that translation at sourceforge (perhaps MIT License) (despite there is a commercial tool called jniwrapper available &lt;A href="http://www.teamdev.com/jniwrapper/downloads.jsf)" target="_blank"&gt;http://www.teamdev.com/jniwrapper/downloads.jsf)&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Is there anybody out there who would be interested in such a module and perhaps willing to help to hold that translation uptodate? Or has somebody performed that task already?&lt;BR /&gt;&lt;BR /&gt;looking forward&lt;BR /&gt;&lt;BR /&gt;Veit&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Jul 2009 04:31:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909343#M83046</guid>
      <dc:creator>veitner</dc:creator>
      <dc:date>2009-07-28T04:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909344#M83047</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/371471"&gt;veitner&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;Hello Forum,&lt;BR /&gt;&lt;BR /&gt;also it is possible to produce a mixed language library to interface a library from java I would prefer to use fortran only. Therefore I would like to start to translate the jni.h header into a fortran module and host that translation at sourceforge (perhaps MIT License) (despite there is a commercial tool called jniwrapper available &lt;A href="http://www.teamdev.com/jniwrapper/downloads.jsf)" target="_blank"&gt;http://www.teamdev.com/jniwrapper/downloads.jsf)&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Is there anybody out there who would be interested in such a module and perhaps willing to help to hold that translation uptodate? Or has somebody performed that task already?&lt;BR /&gt;&lt;BR /&gt;looking forward&lt;BR /&gt;&lt;BR /&gt;Veit&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
Veit,&lt;BR /&gt;&lt;BR /&gt;I don't want to discourage you but before starting a (considerable) effort of translating jni.h header read &lt;A href="http://software.intel.com/en-us/forums/showpost.php?p=12912"&gt;this excellent article by Lorri Menard&lt;/A&gt;. The risk is that your translation will be valid for specific version only, as every new Java comes with new header.&lt;BR /&gt;&lt;BR /&gt;A.&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Jul 2009 06:19:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909344#M83047</guid>
      <dc:creator>ArturGuzik</dc:creator>
      <dc:date>2009-07-28T06:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909345#M83048</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/342379"&gt;ArturGuzik&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Veit,&lt;BR /&gt;&lt;BR /&gt;I don't want to discourage you but before starting a (considerable) effort of translating jni.h header read &lt;A href="http://software.intel.com/en-us/forums/showpost.php?p=12912"&gt;this excellent article by Lorri Menard&lt;/A&gt;. The risk is that your translation will be valid for specific version only, as every new Java comes with new header.&lt;BR /&gt;&lt;BR /&gt;A.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Hello Artur,&lt;BR /&gt;&lt;BR /&gt;I know that Article and also the basing one from Chris Andersson with the nice sample of transient Heat Transfer.&lt;BR /&gt;My hope is to save an additional function call (in the app I'm working on I've at least 30000 calls). Pretty sure that combining Intel C++ and Fortran Compilers will inline the fortran functions but I'm not really happy with licensing the C++ Compiler only for some wrapping functions.&lt;BR /&gt;And I doubt that the GNU C++ compiler is able to inline the fortran code (I did not play around much but in the first try I got two dll's - the used makefile for the Anderson sample is attached).&lt;BR /&gt;But of course the effort is not neglectable to save a function call only - I've to do some tests first if it is worth the work.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Makefile:&lt;BR /&gt;CCFLAGS = -O -shared -Wl,--kill-at,--add-stdcall-alias&lt;BR /&gt;CPPDEFINES = -D __FORTRAN_BUILD__ -D __cplusplus&lt;BR /&gt;FFLAGS1 = -O -dll&lt;BR /&gt;FFLAGS2 = -O -shared -fno-underscoring&lt;BR /&gt;FC  = ifort&lt;BR /&gt;FFLAGS = $(FFLAGS1)&lt;BR /&gt;&lt;BR /&gt;IDIRS = -I/include/java -I/lib/gcc/mingw32/3.4.5/include/gcj&lt;BR /&gt;CCLIBS = &lt;BR /&gt;&lt;BR /&gt;OFILES = tempCalcRoutines.dll&lt;BR /&gt;OBJ = tempCalcRoutines.obj&lt;BR /&gt;OLIB = tempCalcRoutines.lib&lt;BR /&gt;&lt;BR /&gt;libTempCalcJava.obj : $(OFILES) &lt;BR /&gt; g++ $(CCFLAGS) -o TempCalcJava.dll $(OFILES) $(CPPDEFINES) $(CCLIBS) $(IDIRS) TempCalcJava.cpp&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;tempCalcRoutines.dll : tempCalcRoutines.f &lt;BR /&gt; $(FC) $(FFLAGS) tempCalcRoutines.f -o tempCalcRoutines.dll&lt;BR /&gt;&lt;BR /&gt;clean:&lt;BR /&gt; rm -f *.dll&lt;BR /&gt; rm -f *.obj&lt;BR /&gt; rm -f *.so&lt;BR /&gt; rm -f *.lib&lt;BR /&gt; rm -f *.exp&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Jul 2009 03:54:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909345#M83048</guid>
      <dc:creator>veitner</dc:creator>
      <dc:date>2009-07-29T03:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909346#M83049</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/371471"&gt;veitner&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt; Pretty sure that combining Intel C++ and Fortran Compilers will inline the fortran functions but I'm not really happy with licensing the C++ Compiler only for some wrapping functions.&lt;BR /&gt;And I doubt that the GNU C++ compiler is able to inline the fortran code &lt;/EM&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Veit,&lt;BR /&gt;&lt;BR /&gt;OK, I see you know all the traps ahead of you. &lt;BR /&gt;&lt;BR /&gt;What about MS C++ ExpressEdition (free)?&lt;BR /&gt;&lt;BR /&gt;In any case, having Fortran would be very, very nice, but the amount of work is considerable with (at few points at least) questionable gain(s).&lt;BR /&gt;&lt;BR /&gt;A.&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Jul 2009 05:51:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909346#M83049</guid>
      <dc:creator>ArturGuzik</dc:creator>
      <dc:date>2009-07-29T05:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909347#M83050</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/342379"&gt;ArturGuzik&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt; &lt;BR /&gt;Veit,&lt;BR /&gt;&lt;BR /&gt;OK, I see you know all the traps ahead of you. &lt;BR /&gt;&lt;BR /&gt;What about MS C++ ExpressEdition (free)?&lt;BR /&gt;&lt;BR /&gt;In any case, having Fortran would be very, very nice, but the amount of work is considerable with (at few points at least) questionable gain(s).&lt;BR /&gt;&lt;BR /&gt;A.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Hi Artur,&lt;BR /&gt;&lt;BR /&gt;Took some time to do some tests (most time spent setting up the compiler and tools in windows).&lt;BR /&gt;&lt;BR /&gt;Short explanation of the test (Visual Studio 2008, Intel Fortran 11.1.038, jdk1.6.0_11):&lt;BR /&gt;A fortran function calculating the dot product of two vectors using blas (mkl).&lt;BR /&gt;A fortran function calculating the dot product in a loop&lt;BR /&gt;A fortran function doing almost nothing&lt;BR /&gt;A c function calculating the dot product in a loop&lt;BR /&gt;A c function doing almost nothing&lt;BR /&gt;&lt;BR /&gt;No idea about inlining - I had to load the fortran dll dynamically, statically did not work probably different calling conventions but I did not find the setting for (I dont feel very comfortable with that VisualStudio thingi). So the test shows the worst case.&lt;BR /&gt;&lt;BR /&gt;The jni binding was created using gluegen from the jogl project.&lt;BR /&gt;&lt;BR /&gt;Results (I repeated several times - tendency was the same):&lt;BR /&gt;&lt;BR /&gt;Timings calling from java:&lt;BR /&gt;$ java -jar ../jdp/dist/jdp.jar &lt;BR /&gt;field length=20000, number of calls/function=300000&lt;BR /&gt;calling Fortran functions:&lt;BR /&gt;ms for 300000 calls to dpmkl (dot product using blas): 825.2&lt;BR /&gt;ms for 300000 calls to dp (dot product via loop): 802.1&lt;BR /&gt;ms for 300000 calls to e1 ((n+1)*n/2.): 5.0&lt;BR /&gt;calling C functions:&lt;BR /&gt;ms for 300000 calls to e2 (dot product in c): 870.3&lt;BR /&gt;ms for 300000 calls to e3 ((n+1)*n/2.): 5.0&lt;BR /&gt;&lt;BR /&gt;Timings calling from c (field length was 20000):&lt;BR /&gt;E:MinGWhomeveitnervsdpbuild&amp;gt;c.exe&lt;BR /&gt;timing of c program calling fortran routines in dll&lt;BR /&gt;field length=20000, number of calls/function=300000&lt;BR /&gt;dpmkl took 1462.500000 ms&lt;BR /&gt;dp took 840.200000 ms&lt;BR /&gt;e1 took 0.000000 ms&lt;BR /&gt;e2 took 846.200000 ms&lt;BR /&gt;e3 took 0.000000 ms&lt;BR /&gt;&lt;BR /&gt;The funny thing is that the blas routine "dot" took almost twice the time in release mode compared to debug mode of the calling c programm - but that is nothing which bothers me currently. &lt;BR /&gt;In debug mode (the fortran dll still with release flags) following results were obtained:&lt;BR /&gt;E:MinGWhomeveitnervsdpbuild&amp;gt;c.exe&lt;BR /&gt;timing of c program calling fortran routines in dll&lt;BR /&gt;field length=20000, number of calls/function=300000&lt;BR /&gt;dpmkl took 777.100000 ms&lt;BR /&gt;dp took 823.600000 ms&lt;BR /&gt;e1 took 2.000000 ms&lt;BR /&gt;e2 took 3047.300000 ms&lt;BR /&gt;e3 took 1.000000 ms&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And here the files (I did not create a makefile - too much effort):&lt;BR /&gt;&lt;BR /&gt;Testprogram in c/c++&lt;BR /&gt;&lt;!----------------------------------------------&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;MALLOC.H&gt;&lt;BR /&gt;#include &lt;MATH.H&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;CONIO.H&gt;&lt;BR /&gt;#include "fext.h"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;int main(int argc, char* argv[])&lt;BR /&gt;{&lt;BR /&gt; static int n=20000;&lt;BR /&gt; static int cm=300000;&lt;BR /&gt;&lt;BR /&gt; double *d1 = (double *)calloc(n,sizeof(double));&lt;BR /&gt; double *d2 = (double *)calloc(n,sizeof(double));&lt;BR /&gt; for (int i=0; i&lt;N&gt;&lt;/N&gt; d1&lt;I&gt;=1.;&lt;BR /&gt; d2&lt;I&gt;=i+1;&lt;BR /&gt; }&lt;BR /&gt; double r = (n+1)*n/2.;&lt;BR /&gt; static double d=1E-8;&lt;BR /&gt;&lt;BR /&gt; clock_t c0, c1;&lt;BR /&gt;&lt;BR /&gt; printf("timing of c program calling fortran routines in dlln");&lt;BR /&gt; printf("field length=%d, number of calls/function=%dn",n,cm);&lt;BR /&gt; double res;&lt;BR /&gt;&lt;BR /&gt; c0 = clock();&lt;BR /&gt; for (int i=0; i&lt;CM&gt;&lt;/CM&gt; res = dpmkl(n,d1,d2);&lt;BR /&gt; if (fabs(r-res)&amp;gt;d) {&lt;BR /&gt; printf("%sn","unexpected result");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; c1 = clock();&lt;BR /&gt;&lt;BR /&gt; printf("dpmkl took %f msn",100.*(c1-c0)/CLOCKS_PER_SEC);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; c0 = clock();&lt;BR /&gt; for (int i=0; i&lt;CM&gt;&lt;/CM&gt; res = dp(n,d1,d2);&lt;BR /&gt; if (fabs(r-res)&amp;gt;d) {&lt;BR /&gt; printf("%sn","unexpected result");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; c1 = clock();&lt;BR /&gt;&lt;BR /&gt; printf("dp took %f msn",100.*(c1-c0)/CLOCKS_PER_SEC);&lt;BR /&gt;&lt;BR /&gt; c0 = clock();&lt;BR /&gt; for (int i=0; i&lt;CM&gt;&lt;/CM&gt; res = e1(n,d1,d2);&lt;BR /&gt; if (fabs(r-res)&amp;gt;d) {&lt;BR /&gt; printf("%sn","unexpected result");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; c1 = clock();&lt;BR /&gt; printf("e1 took %f msn",100.*(c1-c0)/CLOCKS_PER_SEC);&lt;BR /&gt;&lt;BR /&gt; c0 = clock();&lt;BR /&gt; for (int i=0; i&lt;CM&gt;&lt;/CM&gt; res = e2(n,d1,d2);&lt;BR /&gt; if (fabs(r-res)&amp;gt;d) {&lt;BR /&gt; printf("%sn","unexpected result");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; c1 = clock();&lt;BR /&gt; printf("e2 took %f msn",100.*(c1-c0)/CLOCKS_PER_SEC);&lt;BR /&gt;&lt;BR /&gt; c0 = clock();&lt;BR /&gt; for (int i=0; i&lt;CM&gt;&lt;/CM&gt; res = e3(n,d1,d2);&lt;BR /&gt; if (fabs(r-res)&amp;gt;d) {&lt;BR /&gt; printf("%sn","unexpected result in e3");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; c1 = clock();&lt;BR /&gt; printf("e3 took %f msn",100.*(c1-c0)/CLOCKS_PER_SEC);&lt;BR /&gt;&lt;BR /&gt; free(d1);&lt;BR /&gt; free(d2);&lt;BR /&gt; printf("npress ENTER to exitn");&lt;BR /&gt; getch();&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;!------------------------------------&gt;&lt;BR /&gt;Header file defining loading the fortran dll&lt;BR /&gt;&lt;!--------------------------------------&gt;&lt;BR /&gt;#ifndef _FEXT_H // Specifies that the minimum required platform is Windows Vista.&lt;BR /&gt;#define _FEXT_H&lt;BR /&gt;&lt;BR /&gt;#include &lt;WINDOWS.H&gt;&lt;BR /&gt;#include &lt;WINDEF.H&gt;&lt;BR /&gt;&lt;BR /&gt;#define WIMPORT __declspec(dllimport)&lt;BR /&gt;#define WCALL1 __cdecl &lt;BR /&gt;#define WCALL __stdcall&lt;BR /&gt;&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;extern "C" {&lt;BR /&gt;#endif&lt;BR /&gt; static HINSTANCE getInst() {&lt;BR /&gt; HINSTANCE dll = LoadLibraryA("dp.dll");&lt;BR /&gt; return dll;&lt;BR /&gt; }&lt;BR /&gt;// WIMPORT double WCALL dp(int n, double *d1, double *d2);&lt;BR /&gt;&lt;BR /&gt; HINSTANCE dll = 0;&lt;BR /&gt;&lt;BR /&gt; typedef double (WCALL dpfp) (int n, double *, double *);&lt;BR /&gt; dpfp* dpmklf = 0;&lt;BR /&gt; dpfp* dpf = 0;&lt;BR /&gt; dpfp* e1f = 0;&lt;BR /&gt;&lt;BR /&gt; double dpmkl(int n, double *d1, double *d2) {&lt;BR /&gt; if (dll==0) dll = getInst();&lt;BR /&gt; if (dpmklf==0) dpmklf = (dpfp*) GetProcAddress((HMODULE) dll, "dpmkl");&lt;BR /&gt; if (dpmklf) {&lt;BR /&gt; return (*dpmklf)(n,d1,d2);&lt;BR /&gt; } else {&lt;BR /&gt; return -1;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; double dp(int n, double *d1, double *d2) {&lt;BR /&gt; if (dll==0) dll = getInst();&lt;BR /&gt; if (dpf==0) dpf=(dpfp*) GetProcAddress((HMODULE) dll, "dp");&lt;BR /&gt; if (dpf) {&lt;BR /&gt; return (*dpf)(n,d1,d2);&lt;BR /&gt; } else {&lt;BR /&gt; return -1;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; double e1(int n, double *d1, double *d2) {&lt;BR /&gt; if (dll==0) dll = getInst();&lt;BR /&gt; if (e1f==0) e1f=(dpfp*) GetProcAddress((HMODULE) dll, "e1");&lt;BR /&gt; if (e1f) {&lt;BR /&gt; return (*e1f)(n,d1,d2);&lt;BR /&gt; } else {&lt;BR /&gt; return -1;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; double e2(int n, double *d1, double *d2) {&lt;BR /&gt; double r=0.;&lt;BR /&gt; int i;&lt;BR /&gt; for (i=0; i&lt;N&gt;&lt;/N&gt; r+=(d1&lt;I&gt;*d2&lt;I&gt;);&lt;BR /&gt; }&lt;BR /&gt; return r;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; double e3(int n, double *d1, double *d2) {&lt;BR /&gt; return (n+1)*n/2.;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;}&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;#endif /* _FEXT_H */&lt;BR /&gt;&lt;BR /&gt;&lt;!------------------------------&gt;&lt;BR /&gt;JNI Binding&lt;BR /&gt;&lt;!------------------------------&gt;&lt;BR /&gt;/* !---- DO NOT EDIT: This file autogenerated by comsungluegenJavaEmitter.java on Wed Jul 29 04:26:24 PDT 2009 ----! */&lt;BR /&gt;&lt;BR /&gt;#include &lt;JNI.H&gt;&lt;BR /&gt;#include &lt;ASSERT.H&gt;&lt;BR /&gt;#include "fext.h"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double dp(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double dp(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_dp0__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d1)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d2)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = dp((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double dp(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double dp(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_dp1__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d1, NULL)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d2, NULL)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = dp((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d1, _ptr1, 0);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d2, _ptr2, 0);&lt;BR /&gt; }&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double dpmkl(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double dpmkl(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_dpmkl0__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d1)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d2)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = dpmkl((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double dpmkl(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double dpmkl(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_dpmkl1__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d1, NULL)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d2, NULL)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = dpmkl((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d1, _ptr1, 0);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d2, _ptr2, 0);&lt;BR /&gt; }&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double e1(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double e1(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_e10__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d1)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d2)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = e1((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double e1(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double e1(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_e11__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d1, NULL)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d2, NULL)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = e1((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d1, _ptr1, 0);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d2, _ptr2, 0);&lt;BR /&gt; }&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double e2(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double e2(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_e20__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d1)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d2)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = e2((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double e2(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double e2(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_e21__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d1, NULL)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d2, NULL)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = e2((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d1, _ptr1, 0);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d2, _ptr2, 0);&lt;BR /&gt; }&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double e3(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double e3(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_e30__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d1)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetDirectBufferAddress(env, d2)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = e3((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Java-&amp;gt;C glue code:&lt;BR /&gt; * Java package: ext.DotProd&lt;BR /&gt; * Java method: double e3(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; * C function: double e3(int n, double * d1, double * d2);&lt;BR /&gt; */&lt;BR /&gt;JNIEXPORT jdouble JNICALL &lt;BR /&gt;Java_ext_DotProd_e31__ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jint n, jobject d1, jint d1_byte_offset, jobject d2, jint d2_byte_offset) {&lt;BR /&gt; double * _ptr1 = NULL;&lt;BR /&gt; double * _ptr2 = NULL;&lt;BR /&gt; double _res;&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; _ptr1 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d1, NULL)) + d1_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; _ptr2 = (double *) (((char*) (*env)-&amp;gt;GetPrimitiveArrayCritical(env, d2, NULL)) + d2_byte_offset);&lt;BR /&gt; }&lt;BR /&gt; _res = e3((int) n, (double *) _ptr1, (double *) _ptr2);&lt;BR /&gt; if (d1 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d1, _ptr1, 0);&lt;BR /&gt; }&lt;BR /&gt; if (d2 != NULL) {&lt;BR /&gt; (*env)-&amp;gt;ReleasePrimitiveArrayCritical(env, d2, _ptr2, 0);&lt;BR /&gt; }&lt;BR /&gt; return _res;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;!---------------------------&gt;&lt;BR /&gt;Fortran file&lt;BR /&gt;&lt;!---------------------------&gt;&lt;BR /&gt;&lt;BR /&gt;function dpmkl(n,d1,d2) result&lt;BR /&gt;!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, ALIAS:"dpmkl" :: dpmkl&lt;BR /&gt; use mkl95_precision, only: wp =&amp;gt; dp&lt;BR /&gt; use mkl95_blas&lt;BR /&gt; implicit none&lt;BR /&gt; integer :: n&lt;BR /&gt; real(wp), dimension(n) :: d1,d2&lt;BR /&gt; real(wp) :: r&lt;BR /&gt; r = dot(d1,d2)&lt;BR /&gt;end function dpmkl&lt;BR /&gt;&lt;BR /&gt;function dp(n,d1,d2) result&lt;BR /&gt;!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, ALIAS:"dp" :: dp&lt;BR /&gt; use mkl95_precision, only: wp =&amp;gt; dp&lt;BR /&gt; implicit none&lt;BR /&gt; integer :: n&lt;BR /&gt; real(wp), dimension(n) :: d1,d2&lt;BR /&gt; real(wp) :: r&lt;BR /&gt; integer :: i&lt;BR /&gt; r = 0.&lt;BR /&gt; do i=1,n&lt;BR /&gt; r=r+d1(i)*d2(i)&lt;BR /&gt; end do&lt;BR /&gt;end function dp&lt;BR /&gt;&lt;BR /&gt;function e1(n,d1,d2) result&lt;BR /&gt;!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, ALIAS:"e1" :: e1&lt;BR /&gt; use mkl95_precision, only: wp =&amp;gt; dp&lt;BR /&gt; implicit none&lt;BR /&gt; integer :: n&lt;BR /&gt; real(wp), dimension(n) :: d1,d2&lt;BR /&gt; real(wp) :: r&lt;BR /&gt; r = (n+1)*n/2.&lt;BR /&gt;end function e1&lt;BR /&gt;&lt;BR /&gt;&lt;!----------------------------------&gt;&lt;BR /&gt;Java binding&lt;BR /&gt;&lt;!----------------------------------&gt;&lt;BR /&gt;/* !---- DO NOT EDIT: This file autogenerated by comsungluegenJavaEmitter.java on Wed Jul 29 04:26:24 PDT 2009 ----! */&lt;BR /&gt;&lt;BR /&gt;package ext;&lt;BR /&gt;&lt;BR /&gt;import com.sun.gluegen.runtime.*;&lt;BR /&gt;&lt;BR /&gt;public class DotProd &lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double dp(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double dp(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; {&lt;BR /&gt; boolean _direct = BufferFactory.isDirect(d1);&lt;BR /&gt; if (d2 != null &amp;amp;&amp;amp; _direct != BufferFactory.isDirect(d2))&lt;BR /&gt; throw new RuntimeException("Argument "d2" : Buffers passed to this method must all be either direct or indirect");&lt;BR /&gt; if (_direct) {&lt;BR /&gt; return dp0(n, d1, BufferFactory.getDirectBufferByteOffset(d1), d2, BufferFactory.getDirectBufferByteOffset(d2));&lt;BR /&gt; } else {&lt;BR /&gt; return dp1(n, BufferFactory.getArray(d1), BufferFactory.getIndirectBufferByteOffset(d1), BufferFactory.getArray(d2), BufferFactory.getIndirectBufferByteOffset(d2));&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double dp(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double dp0(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double dp(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double dp1(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double dp(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double dp(int n, double[] d1, int d1_offset, double[] d2, int d2_offset)&lt;BR /&gt; {&lt;BR /&gt; if(d1 != null &amp;amp;&amp;amp; d1.length &amp;lt;= d1_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d1_offset" (" + d1_offset + ") equals or exceeds array length (" + d1.length + ")");&lt;BR /&gt; if(d2 != null &amp;amp;&amp;amp; d2.length &amp;lt;= d2_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d2_offset" (" + d2_offset + ") equals or exceeds array length (" + d2.length + ")");&lt;BR /&gt; return dp1(n, d1, BufferFactory.SIZEOF_DOUBLE * d1_offset, d2, BufferFactory.SIZEOF_DOUBLE * d2_offset);&lt;BR /&gt;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double dpmkl(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double dpmkl(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; {&lt;BR /&gt; boolean _direct = BufferFactory.isDirect(d1);&lt;BR /&gt; if (d2 != null &amp;amp;&amp;amp; _direct != BufferFactory.isDirect(d2))&lt;BR /&gt; throw new RuntimeException("Argument "d2" : Buffers passed to this method must all be either direct or indirect");&lt;BR /&gt; if (_direct) {&lt;BR /&gt; return dpmkl0(n, d1, BufferFactory.getDirectBufferByteOffset(d1), d2, BufferFactory.getDirectBufferByteOffset(d2));&lt;BR /&gt; } else {&lt;BR /&gt; return dpmkl1(n, BufferFactory.getArray(d1), BufferFactory.getIndirectBufferByteOffset(d1), BufferFactory.getArray(d2), BufferFactory.getIndirectBufferByteOffset(d2));&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double dpmkl(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double dpmkl0(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double dpmkl(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double dpmkl1(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double dpmkl(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double dpmkl(int n, double[] d1, int d1_offset, double[] d2, int d2_offset)&lt;BR /&gt; {&lt;BR /&gt; if(d1 != null &amp;amp;&amp;amp; d1.length &amp;lt;= d1_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d1_offset" (" + d1_offset + ") equals or exceeds array length (" + d1.length + ")");&lt;BR /&gt; if(d2 != null &amp;amp;&amp;amp; d2.length &amp;lt;= d2_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d2_offset" (" + d2_offset + ") equals or exceeds array length (" + d2.length + ")");&lt;BR /&gt; return dpmkl1(n, d1, BufferFactory.SIZEOF_DOUBLE * d1_offset, d2, BufferFactory.SIZEOF_DOUBLE * d2_offset);&lt;BR /&gt;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double e1(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double e1(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; {&lt;BR /&gt; boolean _direct = BufferFactory.isDirect(d1);&lt;BR /&gt; if (d2 != null &amp;amp;&amp;amp; _direct != BufferFactory.isDirect(d2))&lt;BR /&gt; throw new RuntimeException("Argument "d2" : Buffers passed to this method must all be either direct or indirect");&lt;BR /&gt; if (_direct) {&lt;BR /&gt; return e10(n, d1, BufferFactory.getDirectBufferByteOffset(d1), d2, BufferFactory.getDirectBufferByteOffset(d2));&lt;BR /&gt; } else {&lt;BR /&gt; return e11(n, BufferFactory.getArray(d1), BufferFactory.getIndirectBufferByteOffset(d1), BufferFactory.getArray(d2), BufferFactory.getIndirectBufferByteOffset(d2));&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double e1(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double e10(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double e1(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double e11(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double e1(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double e1(int n, double[] d1, int d1_offset, double[] d2, int d2_offset)&lt;BR /&gt; {&lt;BR /&gt; if(d1 != null &amp;amp;&amp;amp; d1.length &amp;lt;= d1_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d1_offset" (" + d1_offset + ") equals or exceeds array length (" + d1.length + ")");&lt;BR /&gt; if(d2 != null &amp;amp;&amp;amp; d2.length &amp;lt;= d2_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d2_offset" (" + d2_offset + ") equals or exceeds array length (" + d2.length + ")");&lt;BR /&gt; return e11(n, d1, BufferFactory.SIZEOF_DOUBLE * d1_offset, d2, BufferFactory.SIZEOF_DOUBLE * d2_offset);&lt;BR /&gt;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double e2(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double e2(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; {&lt;BR /&gt; boolean _direct = BufferFactory.isDirect(d1);&lt;BR /&gt; if (d2 != null &amp;amp;&amp;amp; _direct != BufferFactory.isDirect(d2))&lt;BR /&gt; throw new RuntimeException("Argument "d2" : Buffers passed to this method must all be either direct or indirect");&lt;BR /&gt; if (_direct) {&lt;BR /&gt; return e20(n, d1, BufferFactory.getDirectBufferByteOffset(d1), d2, BufferFactory.getDirectBufferByteOffset(d2));&lt;BR /&gt; } else {&lt;BR /&gt; return e21(n, BufferFactory.getArray(d1), BufferFactory.getIndirectBufferByteOffset(d1), BufferFactory.getArray(d2), BufferFactory.getIndirectBufferByteOffset(d2));&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double e2(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double e20(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double e2(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double e21(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double e2(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double e2(int n, double[] d1, int d1_offset, double[] d2, int d2_offset)&lt;BR /&gt; {&lt;BR /&gt; if(d1 != null &amp;amp;&amp;amp; d1.length &amp;lt;= d1_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d1_offset" (" + d1_offset + ") equals or exceeds array length (" + d1.length + ")");&lt;BR /&gt; if(d2 != null &amp;amp;&amp;amp; d2.length &amp;lt;= d2_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d2_offset" (" + d2_offset + ") equals or exceeds array length (" + d2.length + ")");&lt;BR /&gt; return e21(n, d1, BufferFactory.SIZEOF_DOUBLE * d1_offset, d2, BufferFactory.SIZEOF_DOUBLE * d2_offset);&lt;BR /&gt;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double e2(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double e3(int n, java.nio.DoubleBuffer d1, java.nio.DoubleBuffer d2)&lt;BR /&gt; {&lt;BR /&gt; boolean _direct = BufferFactory.isDirect(d1);&lt;BR /&gt; if (d2 != null &amp;amp;&amp;amp; _direct != BufferFactory.isDirect(d2))&lt;BR /&gt; throw new RuntimeException("Argument "d2" : Buffers passed to this method must all be either direct or indirect");&lt;BR /&gt; if (_direct) {&lt;BR /&gt; return e20(n, d1, BufferFactory.getDirectBufferByteOffset(d1), d2, BufferFactory.getDirectBufferByteOffset(d2));&lt;BR /&gt; } else {&lt;BR /&gt; return e21(n, BufferFactory.getArray(d1), BufferFactory.getIndirectBufferByteOffset(d1), BufferFactory.getArray(d2), BufferFactory.getIndirectBufferByteOffset(d2));&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double e2(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double e30(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Entry point to C language function: &lt;BR /&gt; &lt;CODE&gt; double e2(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; private static native double e31(int n, Object d1, int d1_byte_offset, Object d2, int d2_byte_offset);&lt;BR /&gt;&lt;BR /&gt; /** Interface to C language function: &lt;BR /&gt; &lt;CODE&gt; double e2(int n, double * d1, double * d2); &lt;/CODE&gt; */&lt;BR /&gt; public static double e3(int n, double[] d1, int d1_offset, double[] d2, int d2_offset)&lt;BR /&gt; {&lt;BR /&gt; if(d1 != null &amp;amp;&amp;amp; d1.length &amp;lt;= d1_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d1_offset" (" + d1_offset + ") equals or exceeds array length (" + d1.length + ")");&lt;BR /&gt; if(d2 != null &amp;amp;&amp;amp; d2.length &amp;lt;= d2_offset)&lt;BR /&gt; throw new RuntimeException("array offset argument "d2_offset" (" + d2_offset + ") equals or exceeds array length (" + d2.length + ")");&lt;BR /&gt; return e31(n, d1, BufferFactory.SIZEOF_DOUBLE * d1_offset, d2, BufferFactory.SIZEOF_DOUBLE * d2_offset);&lt;BR /&gt;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;} // end of class DotProd&lt;BR /&gt;&lt;BR /&gt;&lt;!----------------------&gt;&lt;BR /&gt;Java Main file&lt;BR /&gt;&lt;!----------------------&gt;&lt;BR /&gt;&lt;BR /&gt;import ext.DotProd;&lt;BR /&gt;import java.io.FileInputStream;&lt;BR /&gt;import java.io.FileOutputStream;&lt;BR /&gt;import java.nio.ByteBuffer;&lt;BR /&gt;import java.nio.DoubleBuffer;&lt;BR /&gt;import java.util.Properties;&lt;BR /&gt;import java.util.logging.Level;&lt;BR /&gt;import java.util.logging.Logger;&lt;BR /&gt;&lt;BR /&gt;/**&lt;BR /&gt; *&lt;BR /&gt; * @author veitner&lt;BR /&gt; */&lt;BR /&gt;public class Main {&lt;BR /&gt;&lt;BR /&gt; /**&lt;BR /&gt; * @param args the command line arguments&lt;BR /&gt; */&lt;BR /&gt;&lt;BR /&gt; static int sizeofdouble = Double.SIZE / 8;&lt;BR /&gt; public static void main(String[] args) {&lt;BR /&gt;// System.out.println(System.getProperty("java.library.path"));&lt;BR /&gt; int n = 20000;&lt;BR /&gt; int nfc = 300000;&lt;BR /&gt; Properties p = new Properties();&lt;BR /&gt; try {&lt;BR /&gt; p.load(new FileInputStream("jdp.cfg"));&lt;BR /&gt; n = Integer.parseInt(p.getProperty("n"));&lt;BR /&gt; nfc = Integer.parseInt(p.getProperty("nfc"));&lt;BR /&gt; } catch (Exception ex) {&lt;BR /&gt; p.put("dp.dll", "E:\MinGW\home\veitner\vs\dp\build\dp.dll");&lt;BR /&gt; p.put("jni.dll", "E:\MinGW\home\veitner\vs\dp\build\jni.dll");&lt;BR /&gt; try {&lt;BR /&gt; p.save(new FileOutputStream("jdp.cfg"), "auto-generated");&lt;BR /&gt; } catch (Exception ex1) {&lt;BR /&gt; Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex1);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; try {&lt;BR /&gt; System.loadLibrary("dp");&lt;BR /&gt; } catch (UnsatisfiedLinkError e) {&lt;BR /&gt; System.out.println("Unable to load lib via System.loadLibrary. Trying System.load("+p.getProperty("dp.dll")+").");&lt;BR /&gt; System.load(p.getProperty("dp.dll"));&lt;BR /&gt; }&lt;BR /&gt; try {&lt;BR /&gt; System.loadLibrary("jni");&lt;BR /&gt; } catch (UnsatisfiedLinkError e) {&lt;BR /&gt; System.out.println("Unable to load lib via System.loadLibrary. Trying System.load("+p.getProperty("jni.dll")+").");&lt;BR /&gt; System.load(p.getProperty("jni.dll"));&lt;BR /&gt; }&lt;BR /&gt; System.out.println("field length="+n+", number of calls/function="+nfc);&lt;BR /&gt; DoubleBuffer b1, b2;&lt;BR /&gt; ByteBuffer b = ByteBuffer.allocateDirect(n * sizeofdouble);&lt;BR /&gt; b1 = b.asDoubleBuffer();&lt;BR /&gt; b = ByteBuffer.allocateDirect(n * sizeofdouble);&lt;BR /&gt; b2 = b.asDoubleBuffer();&lt;BR /&gt; double[] d1 = new double&lt;N&gt;;&lt;BR /&gt; double[] d2 = new double&lt;N&gt;;&lt;BR /&gt; for (int i = 0; i &amp;lt; n; i++) {&lt;BR /&gt; b1.put(1.);&lt;BR /&gt; b2.put(i + 1);&lt;BR /&gt; d1&lt;I&gt; = 1.;&lt;BR /&gt; d2&lt;I&gt; = (i + 1);&lt;BR /&gt;&lt;BR /&gt; }&lt;BR /&gt; //the result of the functions has to be sum(i,i=1,n)=(n+1)*n/2.&lt;BR /&gt; double res = (n + 1) * n / 2.;&lt;BR /&gt;&lt;BR /&gt; long start, stop;&lt;BR /&gt; double elapsed;&lt;BR /&gt; System.out.println("calling Fortran functions:");&lt;BR /&gt; start = System.currentTimeMillis();&lt;BR /&gt; double dp = 0.;&lt;BR /&gt; for (int i = 0; i &amp;lt; nfc; i++) {&lt;BR /&gt; //todo: fix call using buffers - it does not work currently&lt;BR /&gt; dp = DotProd.dpmkl(n, d1, 0, d2, 0);&lt;BR /&gt; if (dp != res) {&lt;BR /&gt; System.out.println("error in dpmkl");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; stop = System.currentTimeMillis();&lt;BR /&gt; //obviously the time is in 1/1000 seconds - factor 10 to convert to 1/100 seconds&lt;BR /&gt; elapsed = (stop - start)/10.;&lt;BR /&gt; System.out.println(new StringBuffer().append("ms for ").append(nfc).append(" calls to dpmkl (dot product using blas): ").append(elapsed).toString());&lt;BR /&gt;&lt;BR /&gt; start = System.currentTimeMillis();&lt;BR /&gt; dp = 0.;&lt;BR /&gt; for (int i = 0; i &amp;lt; nfc; i++) {&lt;BR /&gt; dp = DotProd.dp(n, d1, 0, d2, 0);&lt;BR /&gt; if (dp != res) {&lt;BR /&gt; System.out.println("error in dp");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; stop = System.currentTimeMillis();&lt;BR /&gt; elapsed = (stop - start)/10.;&lt;BR /&gt; System.out.println(new StringBuffer().append("ms for ").append(nfc).append(" calls to dp (dot product via loop): ").append(elapsed).toString());&lt;BR /&gt;&lt;BR /&gt; start = System.currentTimeMillis();&lt;BR /&gt; dp = 0.;&lt;BR /&gt; for (int i = 0; i &amp;lt; nfc; i++) {&lt;BR /&gt; dp = DotProd.e1(n, d1, 0, d2, 0);&lt;BR /&gt; if (dp != res) {&lt;BR /&gt; System.out.println("error in e1");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; stop = System.currentTimeMillis();&lt;BR /&gt; elapsed = (stop - start)/10.;&lt;BR /&gt; System.out.println(new StringBuffer().append("ms for ").append(nfc).append(" calls to e1 ((n+1)*n/2.): ").append(elapsed).toString());&lt;BR /&gt;&lt;BR /&gt; System.out.println("calling C functions:");&lt;BR /&gt; start = System.currentTimeMillis();&lt;BR /&gt; dp = 0.;&lt;BR /&gt; for (int i = 0; i &amp;lt; nfc; i++) {&lt;BR /&gt; dp = DotProd.e2(n, d1, 0, d2, 0);&lt;BR /&gt; if (dp != res) {&lt;BR /&gt; System.out.println("error in e2");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; stop = System.currentTimeMillis();&lt;BR /&gt; elapsed = (stop - start)/10.;&lt;BR /&gt; System.out.println(new StringBuffer().append("ms for ").append(nfc).append(" calls to e2 (dot product in c): ").append(elapsed).toString());&lt;BR /&gt;&lt;BR /&gt; start = System.currentTimeMillis();&lt;BR /&gt; dp = 0.;&lt;BR /&gt; for (int i = 0; i &amp;lt; nfc; i++) {&lt;BR /&gt; dp = DotProd.e3(n, d1, 0, d2, 0);&lt;BR /&gt; if (dp != res) {&lt;BR /&gt; System.out.println("error in e3");&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; stop = System.currentTimeMillis();&lt;BR /&gt; elapsed = (stop - start)/10.;&lt;BR /&gt; System.out.println(new StringBuffer().append("ms for ").append(nfc).append(" calls to e3 ((n+1)*n/2.): ").append(elapsed).toString());&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And at the end I would say the mentioned IDE is worth a look. Especially then you dont bother in some breaks having a coffee or joining a meeting while waiting for the IDE.&lt;BR /&gt;&lt;BR /&gt;And I learned for the future that it would make much more sense to read some  Docs regarding Compiler Settings instead dreaming of performance by making code changes only.&lt;BR /&gt;&lt;BR /&gt;Thank you for forcing me to rethink  the idea. That saved me a lot of time spending just in an illusion.&lt;BR /&gt;&lt;BR /&gt;Some questions are still open:&lt;BR /&gt;What is with the mkl in release mode (I did not change any of the debug/release flags in VS2008)?&lt;BR /&gt;Will the the Intel C Compiler increase performace (maybe I'll download a trial edition to test)?&lt;BR /&gt;Why is the VS2008 generated code slower except in the inlined C Functions than the JNI method invocations?&lt;BR /&gt;Why does  passing of DoubleBuffers dont work (I can remember some time ago that this was working - at least on Solaris)?&lt;BR /&gt;Are the timings correct (One can not switch off garbage collection in java)?&lt;BR /&gt;&lt;BR /&gt;Oh and at least - my testsystem is WinXP in VirtualBox running on SolarisX86. So maybe  different results on a windows only host (mkl parallel).&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;&lt;/I&gt;&lt;/N&gt;&lt;/N&gt;&lt;/ASSERT.H&gt;&lt;/JNI.H&gt;&lt;/I&gt;&lt;/I&gt;&lt;/WINDEF.H&gt;&lt;/WINDOWS.H&gt;&lt;/I&gt;&lt;/I&gt;&lt;/CONIO.H&gt;&lt;/TIME.H&gt;&lt;/MATH.H&gt;&lt;/MALLOC.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Wed, 29 Jul 2009 14:03:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909347#M83050</guid>
      <dc:creator>veitner</dc:creator>
      <dc:date>2009-07-29T14:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909348#M83051</link>
      <description>&lt;DIV style="margin: 0px; height: auto;"&gt;&lt;/DIV&gt;
Blame on me...&lt;BR /&gt;&lt;BR /&gt;During the night I got enlightment (some at least).&lt;BR /&gt;The timings posted yesterday are wrong by a factor of 10.&lt;BR /&gt;Milli=10^-3 instead of 10^-2 as in the last posted codings (the C-Program divides the clock difference by 100 and CLOCKS_PER_SECONDS instead of 1000 and CLOCKS_PER_SECONDS and the Java Program the TimeMillis by 10). I relied on the C program coded first and adapted the Java code accordingly. With a stop watch I checked the numbers and did the same error again - I multiplied the seconds by 100 instead of 1000 and compared them to the results of the Code.&lt;BR /&gt;&lt;BR /&gt;Sorry for the error&lt;BR /&gt;&lt;BR /&gt;Veit&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Jul 2009 05:15:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909348#M83051</guid>
      <dc:creator>veitner</dc:creator>
      <dc:date>2009-07-30T05:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909349#M83052</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/371471"&gt;veitner&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Some questions are still open:&lt;BR /&gt;What is with the mkl in release mode (I did not change any of the debug/release flags in VS2008)?&lt;BR /&gt;Will the the Intel C Compiler increase performace (maybe I'll download a trial edition to test)?&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Thanks for update.&lt;BR /&gt;&lt;BR /&gt;(1) MKL is always in release mode, no switches required (actually you're never allowed to distribute Debug libs as well)&lt;BR /&gt;(2) I think so. I mean it's usually much faster than MS. You have many optimization options available.&lt;BR /&gt;&lt;BR /&gt;A.&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Jul 2009 05:28:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909349#M83052</guid>
      <dc:creator>ArturGuzik</dc:creator>
      <dc:date>2009-07-30T05:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909350#M83053</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/342379"&gt;ArturGuzik&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt; &lt;BR /&gt;Thanks for update.&lt;BR /&gt;&lt;BR /&gt;(1) MKL is always in release mode, no switches required (actually you're never allowed to distribute Debug libs as well)&lt;BR /&gt;(2) I think so. I mean it's usually much faster than MS. You have many optimization options available.&lt;BR /&gt;&lt;BR /&gt;A.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
Hi Artur,&lt;BR /&gt;&lt;BR /&gt;the funny thing with the call to the blas routine "dot" is:&lt;BR /&gt;C executable in debug mode: fast&lt;BR /&gt;C executable in release mode: slow&lt;BR /&gt;It's probably some MS specific behavior.&lt;BR /&gt;Attached I added all the files including an Makefile. Before calling the makefile you have to adjust the JAVAHOME Variable to point to your jdk. And you have to supply the path to MKL while launching.&lt;BR /&gt;Issue some command like&lt;BR /&gt;nmake MKLROOT="c:intelcompilerlatestmkl" lib32&lt;BR /&gt;But somehow the settings for the jni.dll are not correct but I cant spend more time to figure that out. So the dll created by the makefile is not callable from java (it produces wrong results - so probably calling convention or integer size or real size or what ever). Building the dll inside VS results in a callable dll - also attached.&lt;BR /&gt;And also the call to gluegen is handwork:&lt;BR /&gt;java -cp gluegen.jar;antlr-2.7.5.jar com.sun.gluegen.GlueGen -I. -Ecom.sun.gluegen.JavaEmitter -Cfext.cfg fext-gg.h&lt;BR /&gt;And I did not include a build script for the java stuff. But a ready made jar file&lt;BR /&gt;java -jar jdp.jar&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Somewhen I have to go through the compiler switches manual&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Veit&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Jul 2009 16:23:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909350#M83053</guid>
      <dc:creator>veitner</dc:creator>
      <dc:date>2009-07-30T16:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909351#M83054</link>
      <description>&lt;DIV style="margin: 0px; height: auto;"&gt;&lt;/DIV&gt;
Ah - I think I know the problem regarding the nonworking jni.dll.&lt;BR /&gt;Because I had no idea howto add the include statement "#include "fext.h"" into generated DotProd_JNI.c using the nmake makefile I renamed the file fext.h to fext.c and linked that two files together to build the dll. Otherwise the compiler complained about an unknown suffix .h.&lt;BR /&gt;&lt;BR /&gt;Veit&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Jul 2009 16:43:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909351#M83054</guid>
      <dc:creator>veitner</dc:creator>
      <dc:date>2009-07-30T16:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: jni.h</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909352#M83055</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/371471"&gt;veitner&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt; Ah - I think I know the problem regarding the nonworking jni.dll.&lt;BR /&gt;Because I had no idea howto add the include statement "#include "fext.h"" into generated DotProd_JNI.c using the nmake makefile I renamed the file fext.h to fext.c and linked that two files together to build the dll. Otherwise the compiler complained about an unknown suffix .h.&lt;BR /&gt;&lt;BR /&gt;Veit&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;To all the c gurus:&lt;BR /&gt;What is the difference between a simple header file like&lt;BR /&gt;&lt;BR /&gt;double d(int n, double* a1, double* a2) {&lt;BR /&gt; int i;&lt;BR /&gt; double r=0.;&lt;BR /&gt; for (int i=0; i&lt;N&gt;&lt;/N&gt; d+=(a1(i)*a2(i));&lt;BR /&gt; }&lt;BR /&gt; return r;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;or a c file having same content.&lt;BR /&gt;&lt;BR /&gt;When I link the c file against another file f.c I get different results compared to an include of the h file in f.c.&lt;BR /&gt;The h file and the c file are exactly the same except of the extension.&lt;BR /&gt;&lt;BR /&gt;Attached are a new jdp.jar (The load of the libiomp5.dll is not needed) and a makefile including a task to generate the JNI_Binding (and adding the include to fext.h to the c source) and therefore a working jni.dll.&lt;BR /&gt;&lt;BR /&gt;The tests showed that the initial idea was nonsense.&lt;BR /&gt;&lt;BR /&gt;As a spinoff resulted a working sample which will enable anybody to call fortran code from java without writing any line of code for the binding by the use of gluegen. Thanks to the developers of the jogl project who created that tool.&lt;BR /&gt;&lt;BR /&gt;Veit.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Jul 2009 12:53:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/jni-h/m-p/909352#M83055</guid>
      <dc:creator>veitner</dc:creator>
      <dc:date>2009-07-31T12:53:04Z</dc:date>
    </item>
  </channel>
</rss>

