How to import existing dll in C/C++ code

Hi guys, I'm new here..I'm still student and do training at one company...my boss ask me to do integration java with C/C++ using JNI...
I very understanding how to do JNI tools for HelloWorld because all tutorials in internet teach me how to create dll for native code..but the problems came when my boss ask me to make with existing API...and i'm tried to search tutorial for existing dll but i can't find...my boss asked me to not use callback function in code...just put null value only...
so, I will give you guys the code that related with my project...hope you guy can teach me as beginner..first of all, i already create java file that I named it as TestMMMReaderHighLevelAPI3.java where its coding likes below:
public class TestMMMReaderHighLevelAPI3{
     static{
               System.out.println("inside static block");               
               try{
                    //System.loadLibrary("MMMReaderHighLevelAPI"); //can't find dependent library -maybe ini bukan native
                            System.loadLibrary("MMMReader_Initialise_L3"); //no this file in java.library.path -have problem when to 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){
          TestMMMReaderHighLevelAPI3 t = new TestMMMReaderHighLevelAPI3();
          try{
               t.MMMReader_Initialise_L3();
               System.out.println("MMMReaderHighLevelAPI DLL method invoked!");
          }catch(UnsatisfiedLinkError e){
               System.out.println("Couldn't Access MMMReaderHighLevelAPI DLL method");
               System.out.println(e + "");
        public native long MMMReader_Initialise_L3();
}the code above mention two dll which is MMMReaderHighLevelAPI and MMMReader_Initialise_L3 where its existing API and non-existing dll respectively...
after i compile this java file, i create header by using command javah -jni TestMMMReaderHighLevelAPI3
the header file is likes below (TestMMMReaderHighLevelAPI3.h) :
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class TestMMMReaderHighLevelAPI3 */
#ifndef _Included_TestMMMReaderHighLevelAPI3
#define _Included_TestMMMReaderHighLevelAPI3
#ifdef __cplusplus
extern "C" {
#endif
* Class:     TestMMMReaderHighLevelAPI3
* Method:    MMMReader_Initialise_L3
* Signature: ()J
JNIEXPORT jlong JNICALL Java_TestMMMReaderHighLevelAPI3_MMMReader_1Initialise_1L3
  (JNIEnv *, jobject);
#ifdef __cplusplus
#endif
#endifNow, in my directory have 3 files which is TestMMMReaderHighLevelAPI3.java, TestMMMReaderHighLevelAPI3.class and TestMMMReaderHighLevelAPI3.h.....then I try to create MMMReader_Initialise_L3.c.....and for your information, I have problem at this area since I'm more to Java guy...at this file, I tried to call existing API which named MMMReaderHighLevelAPI where in this API contained MMMReader_Initialise function inside it....I tried to call this function by MMMReader_Initialise_L3.c but I dont know to do...
#include <jni.h>
#include <stdio.h>
#include "TestMMMReaderHighLevelAPI3.h"
//#include "MMMReaderHighLevelAPI.h"
//#include "MMMReaderHighLevelAPI.lib"
//#include "MMMReaderHLDataCallback.h"
//#include "MMMReaderEventCallback.h"
//#include "MMMReaderErrorCallback.h"
//#include "MMMReaderCertificateCallback.h"
//is'it  MMMReaderHighLevelAPI.dll need include in cpp code
JNIEXPORT jlong JNICALL
Java_TestMMMReaderHighLevelAPI3_MMMReader_Initialise_L3(JNIEnv *env, jobject obj)Library "MMMReaderHighLevelAPI"
         printf("Successful");
         return;
};i tried to rebuild all, but have problem at Java_TestMMMReaderHighLevelAPI3_MMMReader_Initialise_L3(JNIEnv *env, jobject obj)Library "MMMReaderHighLevelAPI" where two syntax are message:
1) syntax error before "Library"
2) [Build Error] [MMMReader_Initialise_L3.0] Error 1
i have stuck in this part....i dont know how to call existing function in existing API under MMMReader_Initialise_L3.c....do you guys have idea to solve my problem....i repeat back, my boss want me initialise hardware machine with computer/laptop...my boss give clue, he dont want callback function..just use null....below are code for MMMReader_Initialise in MMMReaderHighLevelAPI.h:
MMM_READER_HIGH_LEVEL_API MMMReaderErrorCode MMMReader_Initialise(
     MMMReaderHLDataCallback aDataCallback,
     MMMReaderEventCallback aEventCallback,
     MMMReaderErrorCallback aErrorCallback,
     MMMReaderCertificateCallback aCertCallback,
     bool aProcessMessages,
     bool aProcessInputMessages,
     void *aParam
);then its came when to declare parameter for MMMReader_Initialise_L3 in native code...i have two coding to show here...and please give me what item that i need to use :
public native long MMMReader_Initialise_L3();or
public native long MMMReader_Initialise_L2(String a, String b, String c, String d, boolean e, boolean f, boolean g);and my last question, in System.loadLibrary(*); which dll that i need insert....either existing dll(MMMReaderHighLevelAPI) or the creating dll(MMMReader_Initialise_L3)....thats all...thank you for spend your time read my problem...i very appreciate..hope you guy can help me...
Edited by: EJP on 12/07/2012 18:24: added {noformat}{noformat} tags: please use them.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Moderator action:
JNIEXPORT jlong JNICALL Java_TestMMMReaderHighLevelAPI3_MMMReader_Initialise_L3(JNIEnv *env, jobject obj)Library "MMMReaderHighLevelAPI"The part after the ')' is obviously a cut and paste error. Remove it.
If you're not a competent C or C++ programmer you shouldn't be attempting this.
As the question is 99% off topic, and as you have shown little understanding of that, let alone the actual topic, I am now locking it.
Edited by: EJP on 17/07/2012 18:47

Similar Messages

  • How to remove Existing dll while deploying biztalk schemas

    Hi Friends,
    How to remove Existing dll while deploying biztalk schemas.
    am getting error property schema dll is being used by other person.just like that..
    Thanks & Regards
    Rajiv

    Goto BizTalk admin console -- > If you know the BizTalk application where this dll is already deployed, select that application. Otherwise select "All Artifacts" --> Select "Resources" folder --> And remove the dll of the above property schema project
    by right clicking on the Artifacts and select remove
    Other option is go to "Schemas" folder of the above BizTalk application (again in admin console),  --> select the schema ---> right click the schema you wan to remove  (Property schema) and click remove.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • How to import existing jsp project into jdeveloper

    can someone help me how to import existing jsp project into jdeveloper?
    can give me step by step to import..cause i am new for jdeveloper..
    thank you very much

    Well there are two options - if you have a WAR file with the code in it, then you can use the file->import WAR.
    Or you can use the new->Project from source code.
    Note that you'll probably need to do some library settings and some directory setting after that.
    Have a look at this demo for basic steps:
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/NBtoJDevProject/NBtoJDevProject.html

  • How to import existing eclipse Project to JDeveloper

    Hi,
         previously I used to use Eclipse IDE. I have started to use Oracle JDeveloper 11.1.2.4.0 now. How can I import my existing Eclipse projects to JDeveloper? Please Note, I already have tried following options -
    "Importing Existing Files into a New JDeveloper Project" from here - Working with Applications and Projects.
    But, When I import the source files from existing Eclipse Projects to JDeveloper, I am not able to crease similar directory structure in the JDeveloper(in Application Navigator). As a result, I can not use my existing ANT build script to build my project[Though JDeveloper build my project,but I want to use manual ANT build.]
    Moreover I don't want to change my existing directory structure as I am working on and existing project and I need to synchronize to my repository(Apache SVN).
    Can any one help me in this - How can I import existing Eclipse Project to JDeveloper? Without any significant change in directory structure.
    Best Regards
    Chandramoulee

    Well there are two options - if you have a WAR file with the code in it, then you can use the file->import WAR.
    Or you can use the new->Project from source code.
    Note that you'll probably need to do some library settings and some directory setting after that.
    Have a look at this demo for basic steps:
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/NBtoJDevProject/NBtoJDevProject.html

  • How to import existing projects into JDeveloper 11g

    I am trying to work with JDeveloper for my application and want to know whether it is possible to import existing projects into the work space in JDeveloper. I am currently working with eclipse IDE and this feature is available in it. How can I connect to clear case from JDeveloper? In eclipse it is very easy to connect to clear case with a plugin installed and check out, check in files from the source control. Any help is greatly appreciated.

    The basic way to import code is to use the "New->Projects->Project from existing code" or "project from WAR" dialogs to create your project.
    You then need to do some tweaking in the project properties->Content (and sub nodes such as resources and Web content).
    And also set the correct JARs/Libraries in the project properties.
    You can use the help->check for update to download the extension to JDeveloper that will let you integrate with Clearcase to do version management.
    This how-to might help you with your migration:
    http://www.oracle.com/technology/products/jdev/howtos/1013/w4wljdev/workshopandjdev.html

  • How to import existing ColdFusion project in the eclipse.

    Hi All,
    I have exiting ColdFusion project in my local drive and I want to import it in Eclipse. I already have CFEclipse installed in Eclipse. Is there any step by step instruction to do this?
    Thanks

    You should be able to copy the folder into your Eclipse workspace folder, then go to File--New--Project and select CFML Project (under CFEclipse).
    If it is an existing Eclipse project, e.g. there is already a .project file in the folder, you can follow the steps at Importing Existing Projects.

  • How to register a dll from the java code

    Hi,
    We can use windows utility Regsv32.exe to register a the components. Is it possible to register the Dll from the java code. If possible please try to provide me the code for the registring the dll.
    Thanks in adavance
    Aswad

    if a try this variant it doesnt work
    static {
            System.loadLibrary("shellExec.dll");
    but in this way it work (without .dll extension)
    static {
            System.loadLibrary("shellExec");
    }

  • How to import existing WLS Portal App into Workshop?

    I have searched and searched, and tried every different combination of imports, with no success.
    I have an existing EAR file, with a Portal Application, created for WebLogic. I am able to deploy it to my server, and it works fine. I would like to import into Workshop (either into a new project, or into an existing project - I've tried both ways), so I can manipulate it (basically, I need to enhance this existing Portal, and I want to use it as a starting point).
    I don't have the complete Portal Workshop directory (I would expect a .work file, and other files related to Workshop), just a deployable EAR (probably generated with Workshop).
    Anyone know how to bring the Portal into Workshop so I can work with it. The only way I can get close to it now, is to create a similar page layout, and import each component singularly then place it in the appropriate location (ie. import a jsp, and put it on the proper page, basically rebuild the app by hand). There has to be a better way - especially since this app has been developed on BEA Platform from the start.
    Any help is mucho appreciated, I am up against a big deadline, and have been pulling my hair out over this.

    Mike Wolfson wrote:
    Anyone know how to bring the Portal into Workshop so I can work with it. The only way I can get close to it now, is to create a similar page layout, and import each component singularly then place it in the appropriate location (ie. import a jsp, and put it on the proper page, basically rebuild the app by hand). There has to be a better way - especially since this app has been developed on BEA Platform from the start.AFAIK there is no automated way to do this. In general the EAR will not contain
    the source code to many of the artifacts other then JSPs. Any class files
    generated from page flows, controls, etc would have to be decompiled manually
    with something like JAD and even with that reassembling the output would be
    quite difficult I imagine.
    So in nutshell, get the source code to the portal if you want to make changes to it.
    Cheers,
    Gerald

  • How to import existing BPM project in jDeveloper

    Hi,
    I am new to oracle BPM.
    I have imported oracle BPM+SOA project in jedeveloper using (file->import->soa archive into soa project). I am able to see SOA composite in jdeveloper but not BPM processes. instead of BPM process it showing "unknown project object"
    I have also used other way like unzip jar file and copy paste all files from jar to jedeveloper project but no use.
    Restarted jdeveloper but still showing error.
    please help me.

    Well there are two options - if you have a WAR file with the code in it, then you can use the file->import WAR.
    Or you can use the new->Project from source code.
    Note that you'll probably need to do some library settings and some directory setting after that.
    Have a look at this demo for basic steps:
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/NBtoJDevProject/NBtoJDevProject.html

  • OSB 11g How to import existing project to Configuration project ?

    Environment: latest OSB 11g + WLS + OOPE , Win 7
    When an exiisting OSB Eclipse project is imported to Configuration project comes a message
    "Path for project must have only one segment"
    What is the solutiion to this problem ?

    One solution
    Exit Eclipse
    Edit manually file <Configuration project> \.settings\com.bea.alsb.core.prefs\container.referenced.projects
    Start Eclipse

  • How to import projects from workshop 8.1 to eclipse for weblogic 11.1

    I see a few howto's for migrating from workshop 8.1 to workshop for 10 but it is not obvious how to import existing 8.1 projects into enterprise pack for eclipse. If there is a how to out there could someone point it to me or maybe give me a quick walk through.
    Jerry

    There is no tooled support for project migration from Workshop to OEPE (regardless of version).
    The biggest question when contemplating such migration is whether you are using Beehive components (NetUI, Controls, etc.). Oracle support for Beehive ended with Workshop. If your application uses these technologies, you will need to stay with Workshop. The last version of Workshop was for WLS 11gR1 (10.3.1). No future versions are planned.
    If your application does not use Beehive components (or you can migrate away from them), then you can move to OEPE. The only supported approach is to recreate necessary projects in OEPE and copy your source code over.
    - Konstantin

  • How to create dll file from c code to use in compactrio 9004 RT controller

    Hi.
    I am using Compactrio 9004 Real time controller and i am new to this. I have a C code and i want to use this with the RT controller.I red that that can be done by creating a dll file and can be called in labview.Can any body expalin how to create a DLL from the c code and be used with this RT controlelr?
    Regards,
    Vishnu

    vishnu123 wrote:
    Hi,
    Earlier in this forum itself in cRIO 900x controllers will run Pharlap and run C/C++ code compiled into .dll files.Can you please tell how to transfer the created DLL to RT controller memory throght FTP?
    Thanks and regards,
    Vishnu
    There is another KB article about this for Pharlap based controllers. And you are right the earlier CompactRIO controllers were Pharlap based. Basically for a deployed application to work, you need to put the DLL through FTP in "/ni-rt/system". If you deploy it directly from the project everything will be loaded into memory through the project environment itself including directly dependable DLLs, (but of course won't survive a power cycle).
    I hope you are aware that while Windows DLLs can work on Pharlap OS they by no means will do so always. The Pharlap OS has not a fully featured Windows API. Also you need to be careful which version of Visual C you are going to use depending on the Pharlap OS version, since the VC runtime DLLs already present on the controller will need to be the same as the ones your Visual C environment likes to link in. Recent Pharlap OS versions use the msvcr71.dll. It's very possible that those runtime libraries can't just simply be copied from a normal Windows installation but might have been recompiled by NI specifically for their controller targets.
    So to avoid problems it's a good idea to make sure your DLL uses the same runtime library DLL or make your DLL to include the static MS runtime.
    Rolf Kalbermatter
    Message Edited by rolfk on 02-05-2008 09:51 AM
    Message Edited by rolfk on 02-05-2008 09:53 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How do I use "LabVIEW dll import wizard" to import NETAPI32.dll

    I am trying to use the LabVIEW dll import wizard for the first time. I am not very familiar in C-coding so this might be a good help instead of configuring CallLibraryFunction nodes myself.
    I want to import NETAPI.dll. I am interested in several functions in that dll, but my main priority is the funtion NetUserGetInfo(). On MSDN I have found that the header file for the mentioned function should be: lmaccess.h (include lm.h).
    My problem is this:
    The shared library contains 317 function(s). But no function is found and recognized in the header file. The following function(s) cannot be wrapped. If you want to import these functions, please review the warning messages next to the functions below. You will need to fix the problems before you can continue with the wizard.
    The function cannot be imported into LabVIEW. This might be caused by one of the following problems:
    The function is not declared in the header file but is exported in the library.
    Check the header file to make sure it contains declarations of the function.
    Undefined symbols can prevent the wizard from recognizing functions and parameters. To correct this problem, check the header file to determine if you must add predefined symbols. Click the Back button to return to the previous page of the wizard to add a predefined symbol (for example, "NIAPI_stdcall = __stdcall" or "NIAPIDefined = 1").
    MIDL_PASS;_STDCALL_SUPPORTED;__cplusplus;
    Any suggestions how I can solve my issue?   

    astrid wrote:
    I am trying to use the LabVIEW dll import wizard for the first time. I am not very familiar in C-coding so this might be a good help instead of configuring CallLibraryFunction nodes myself.
    I want to import NETAPI.dll. I am interested in several functions in that dll, but my main priority is the funtion NetUserGetInfo(). On MSDN I have found that the header file for the mentioned function should be: lmaccess.h (include lm.h).
    My problem is this:
    The shared library contains 317 function(s). But no function is found and recognized in the header file. The following function(s) cannot be wrapped. If you want to import these functions, please review the warning messages next to the functions below. You will need to fix the problems before you can continue with the wizard.
    The function cannot be imported into LabVIEW. This might be caused by one of the following problems:
    The function is not declared in the header file but is exported in the library.
    Check the header file to make sure it contains declarations of the function.
    Undefined symbols can prevent the wizard from recognizing functions and parameters. To correct this problem, check the header file to determine if you must add predefined symbols. Click the Back button to return to the previous page of the wizard to add a predefined symbol (for example, "NIAPI_stdcall = __stdcall" or "NIAPIDefined = 1").
    MIDL_PASS;_STDCALL_SUPPORTED;__cplusplus;
    Any suggestions how I can solve my issue?   
    Sorry I forgot the attachment, but here it is.
    Attachments:
    NETAPI32.doc ‏103 KB

  • How to access C/C++ functions in Java using existing .dll library

    Hi JNI Guru's,
    I am having well written API in C/C++.This C/C++ files are made into *.dll files.The api are working fine.
    I wan't access the C/C++ api functions in Java., just using System.LoadLibrary("*.dll").Is it possible.I kindly request you to suggest some examples and how to do this.
    Its Urgent !.
    Thanks and Regards,
    V K LAL

    In general you cannot simply access dlls that have already been written. The DLLs called using JNI must conform to JNI calling standards.
    This means you will probably have to write one or more "wrapper" dlls which a) provide the correct JNI interface, and b) call the existing dlls.
    There are some programs around that claim to be able to generate such wrappers. Try a google search for "wrapper", "jni", "generate".
    The JNI tutorial covers creating wrappers.

  • I am looking for assistence how to import an existing website in Dreamweaver CS4

    I need help to import an existing website in Dreamweaver CS4

    Only have one Dreamweaver CS4 installed, trying to get my DW CS4 disk I
    bought installed on computer (done)  I only need to figure out  how to link
    my website to the DW CS4 on my second computer.
    L. Francesca Ferrari, L.Ac., DTCM, DMQ (China)
    Ferrari Center of Chinese Medicine
    222 Forest Avenue
    Pacific Grove, CA 93950
    831.818.3993
    www.francescaferrari.com
    L. Francesca Ferrari, L.Ac., DMQ (China)
    Department Chair Medical Qigong Science
    Five Branches University
    This message, together with any attachments, is intended only for the use of
    the individual or entity to which it is addressed and may contain
    information that is confidential and prohibited from disclosure. If you are
    not the intended recipient, you are hereby notified that any dissemination,
    or copying of this message, or any attachment, is strictly prohibited. If
    you have received this message in error, please notify the original sender
    immediately by telephone or by return e-mail and delete this message, along
    with any attachments, from your computer.
    From: "Nancy O." <[email protected]>
    Reply-To: <[email protected]>
    Date: Sat, 04 Sep 2010 18:34:03 -0600
    To: Francesca Ferrari <[email protected]>
    Subject: i am looking for assistence how to import an existing
    website in Dreamweaver CS4
    >> I do not know where the site files are. They are on my initial Mac laptop
    >> computer, and I use Hostway as my server.
    Do you mean you lost your local copy of your site files from on an old
    computer?
    Log-in to your Remote Server and GET the site files using DW or your favorite
    FTP application (Cute, Filezilla, WS_ftp, etc....)
    >> But I was distinctly told my the call yesterday with Adobe that I must have
    >> CS5 to get my website, www.francescaferrari.com with Dreamweaver on my
    >> second computer.
    Which version of DW did you have before?
    How many installations of DW did you have? You can have up to 2 at a time.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    >

Maybe you are looking for