Thread: link library for JNI - integration purposes

  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    11

    link library for JNI - integration purposes

    Hye all, Im want seek help from you guys....I use Dev-C++ as my platform to do c program and header file....i in progress to integrate this c program with java program....and now, im already link my c program with existing dll...where in c program i will called function in existing dll....for simply flow, its just like this:

    java program will load c program where in c program contain existing dll that have many function inside it...then, i interested to call one of the function from the dll, named MMReader_Initialise....ok, its just overview only...

    so now, i have problem when to compile all of this in cmd window....some said just use : CL -LD MMMReader_Initialise_L5.c MMMReaderHighLevelAPI.lib -FeMMMReader_Initialise_L5.dll...but it came with error like this :
    Microsoft <R> 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
    Copyright <c> Microsoft Corporation. All rights reserved.

    MMMReader_Initialise_L5.c
    MMMReader_Initialise_L5.c<1> : fatal error C1083: Cannot open include file: 'jni.h': No such file or directory

    they said, Dev-C++ cannot support this command just only Microsoft Visual Studio..but I really want to know by using Dev-C++...can you guys help me....below is the reference for related code:

    MMMReader_Initialise_L5.c :
    Code:
    #include <jni.h>
    #include <stdio.h>
    #include "TestMMMReaderHighLevelAPI5.h"
    #include "MMMReaderHighLevelAPI.h"
    
    
    
    
    JNIEXPORT void JNICALL 
     Java_TestMMMReaderHighLevelAPI5_MMMReader_1Initialise_1L5(JNIEnv *env, jobject obj)//Library "MMMReaderHighLevelAPI"
     {
                int hwnd;          
                hwnd = MMMReader_Initialise(null, null, null, null, false, false, null);
                return;                                                       
        
            
     };

    TestMMMReaderHighLevelAPI5.java
    Code:
    public class TestMMMReaderHighLevelAPI5{
    	static{
    			System.out.println("inside static block");			
    			try{
    				//System.loadLibrary("MMMReaderHighLevelAPI"); //can't find dependent library -mungkin ini bukan native
                                System.loadLibrary("MMMReader_Initialise_L5"); //no this file in java.library.path -ade masalah nk rebuild all	
                                System.out.println("Loaded MMMReaderHighLevelAPI DLL");
    			}catch(UnsatisfiedLinkError e){
    				System.out.println("Couldn't load MMMReaderHighLevelAPI DLL");
    				System.out.println(e.getMessage());
    			}
    	}
    
    
    	public static void main(String[] args){
    		
    		TestMMMReaderHighLevelAPI5 t = new TestMMMReaderHighLevelAPI5();
    		try{
    			t.MMMReader_Initialise_L5();
                            //t.MMMReader_Initialise_L();
    			System.out.println("MMMReaderHighLevelAPI DLL method invoked!");
    		}catch(UnsatisfiedLinkError e){
    			System.out.println("Couldn't Access MMMReaderHighLevelAPI DLL method");
    			System.out.println(e + "");
    		}
                //new TestMMMReaderHighLevelAPI5().MMMReader_Initialise_L5();
    	}
    	
    	
            public native void MMMReader_Initialise_L5();
            //public native long MMMReader_Initialise_L();
    }
    i want refresh back about this command, CL -LD MMMReader_Initialise_L5.c MMMReaderHighLevelAPI.lib -FeMMMReader_Initialise_L5.dll , u guys think, this -FeMMMReader_Initialise_L5.dll is dll for c program or dll for existing API...im not sure about this..thanks for spending ur time read my thread...

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Google found this link; it hopefully helps JNI-MinGW-DLL | MinGW

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    yo Paan, i'm not all that interested in helping you if you don't answer questions in previous threads and instead keep starting new ones.

  4. #4
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    Quote Originally Posted by dmh2000 View Post
    yo Paan, i'm not all that interested in helping you if you don't answer questions in previous threads and instead keep starting new ones.

    sori....im forgot that i write before this...u can see my reply there

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to link a library in eclipse c/c++ ide?
    By ayanbizz in forum C++ Programming
    Replies: 2
    Last Post: 11-01-2011, 06:15 AM
  2. link with C runtime library
    By George2 in forum C++ Programming
    Replies: 26
    Last Post: 02-05-2008, 01:56 AM
  3. C# and C++ static library integration?
    By gotclout in forum C# Programming
    Replies: 5
    Last Post: 06-07-2006, 06:10 AM
  4. Replies: 19
    Last Post: 01-12-2006, 11:04 AM
  5. Dev C++ library to link
    By WDT in forum Networking/Device Communication
    Replies: 3
    Last Post: 03-20-2004, 11:20 AM