How to compile a dll for JNI in the CMD correctly

Now I find alot of old threads on using the mno command in cygwin to created dlls to use as an interface between c and Java, however I know this command is no longer available in cygwin and so I took the advid of downloading minGW and using this in the CMD instead.
However every example I try to compile and run this way throws the unsatified link error when the native function is to be called by the Java program. I believe it must be a compiling error creating a mismatch between the native function and the function to be called.
Here is the method I'm using to comile dlls for JNI, it is from the FAQ section of the minGw website:
gcc -Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at
-Ic:/j2sdk1.4.1_02/include -Ic:/j2sdk1.4.1_02/include/win32
-shared someJavaImp.c -o JavaImp.dll
Is this how dll should be compiled? If not any suggestions?

sudsey wrote:
I know how to program well in C and Java, I just need to know the proper way to compile a dll for JNI.1. Get the MS IDE
2. Create a dll project - it must NOT be a managed dll
3. All done.

Similar Messages

  • I have an external hard drive that was formatted by a PC and has files and directories etc. I want to format it and use it on my IMAC for backup but I can't seem to write to it nor can I delete current content. How do I initialize it for use with the MAC?

    I have an external hard drive that was formatted by a PC and has files and directories copied to it etc. I want to use it on my IMAC for backup. I see it on my my IMAC . I can open files etc.  But I can't seem to write to it nor can I delete current content. I don't care if I lose current content. How do I initialize it for use with the MAC?

    You can't write to it because it's formatted as NTFS which OS X will read but not write to. If you want to continue using the drive with both a PC and OS X you will need to download and install NTFS-3G so you can then write to it from your Mac. You can get NTFS-3G at:
    http://www.macupdate.com/app/mac/24481/ntfs-3g
    If you want to use the drive exclusively with your Mac then move the data off it and reformat it in Disk Utility (Applications - Utilities - Disk Utilities) as Mac OS Extended (Journaled.)

  • How can you get audio for  books on the kindle

    how can you get audio for  books on the kindle

    The audio inputs on Macs are line level inputs and not mic inputs.  You need a mic with a built in preamp (battery powered) or more conveniently a USB mic or bluetooth headset.

  • How can I add keywords for SEO into the code?

    How can I add keywords (for SEO) into the code of a Muse designed site?

    You might also be interested in the upcoming MuseJam on Thursday Muse Jam: Search Engine Optimization | Facebook
    Muse Jam: Search Engine Optimization
    Online May 22, 2013
    Join Principal Product Manager Dani Beaumont of the Adobe Muse team as she explores ways within the Muse application to build search engine optimized sites by way of metadata, keywords, H1 definitions, and sitemap generation. After the presentation we'll open the floor to any questions you might with the application.

  • How can I purchase items for app when the app was loaded on another ID before? I has to Chang my AppleID and also transferred an app to new phone. I can't purchase items for app because it wants me to buy the app through new ID. The app was free.

    How can I purchase items for app when the app was loaded on another ID before? I has to Chang my AppleID and also transferred an app to new phone. I can't purchase items for app because it wants me to buy the app through new ID. The app was free.

    All apps (and other content from the store) are tied to the account that downloaded them, whether or not they are free. To do in-app purchases in that app you will either need to log in with the account that downloaded it, or delete it (which will delete its content) and download it with your currently logged in account if you want to do IAPs on that account.

  • Creating dll for JNI

    hi,
    anyone know how to create a dll in visual studio.net for JNI dynamic shared link library?

    I think cl.exe is available even in Visual Studio .NET
    So,
    cl -Ic:\java\include -Ic:\java\include\win32
          -LD HelloWorldImp.c -Fehello.dllshould work
    $

  • How to compile a dll in window

    Hi ALL:
    I want a compile a java program through natvie method in c . Below is my code
    cl -I"c:\Program Files\j2sdk_nb\j2sdk1.4.2\include" -I"c:\Program Files\j2sdk_nb\j2sdk1.4.2\include\win32" -I"c:\Program Files\Microsoft Visual Studio\VC98\include" -LD Analyze.c -FeAnalyze.dllAnd there is a error message
    Command line error D2003 : missing source filenameBut I certain a file called Analyze.c in the path , why ther error ouccer???
    Can anyone help me
    Thanks in advance

    Hallo,
    You have not specified your problem very well. As I understand it, you want to be able to start the Java VM from C, and then call some Java methods from your C code. Is that correct? Or are you trying to create some native methods, that you can call from java?
    Your first problem is that you have not specified any code! You have just shown how you want to start the Microsoft compiler to compile your DLL. You have clearly not specified the compiler parameters correctly.
    I respectfully suggest that this is the wrong forum to get help with your Microsoft compiler problem. You need to read the documentation that comes with the compiler. It is very comprehensive. I would in any case ask: Why are you trying to compile your code from the command line? It is normally very much easier to create a Visual Studio project and do everything from within Visual Studio itself.

  • How to compile external procedure for Linxu

    Hello to all.
    I'm not able to find how to compile external procedure on Linux.
    I have 64bit release Linux (I don't know if I need special 64bit library or not).
    I found only something like that:
    gcc -fPIC -shared -o comsh64.so comsh64.c
    Listener are correctly configured.
    Library is in Oracle bin directory.
    If I run select externproc from dual ... I don't receive any error message but program don't work.
    I think that there is some missing parameter in gcc or some small thing ?
    Thank you for possible answeer
    Filip

    Do you have someone any idea?
    Now I have 1 library, 2 functions and 1 package with 2 functions:
    int renamefile(char source, char destination)
    { int result;
    result=rename(source,destination);
    return result;
    int comexi (char *c)
    { int ret;
    ret = system(c);
    return ret;
    FUNCTION callSystemI(c in varchar2) RETURN binary_integer is
    EXTERNAL LIBRARY extern_utils
    NAME "comexi"
    LANGUAGE C
    PARAMETERS (c string);
    function renamefile (src IN varchar2, dst IN varchar2) return binary_integer
    AS EXTERNAL
    NAME "renamefile"
    LIBRARY extern_utils
    LANGUAGE C
    PARAMETERS (src string, dst string);
    The first function still don't works, second function works.
    Why?

  • How to compile a kernel module without recompiling the whole kernel?

    Hi,
    I'm pretty sure my question is a bit newbish, still I haven't been able to found any information/solution to my problem in 3days.
    The kernel I use doesn't come with the module I need for my hardware and I would like to know if there's a way to compile it without having to make a new kernel myself (since compiling the kernel takes ages on my machine).
    Even if your answer is a "Let me Google that for you", I'm so desperate that I'll be happy to see it.
    Thank you all in advance for your answers!

    Do you have a /proc/config.gz that you could use? Otherwise I don't know. I mean, many modules should be compilable simply with the system-installed kernel headers, but not all native modules might follow that rule.
    Unfortunatel most of what you find on the web talks about how to create new modules which can be compild against the installed kernel tree, not about how to compile one of the native kernel modules against it.
    Actually, try what those links suggest.
    Skip the configuration part, and just do:
    make -C /lib/modules/`uname -r`/build M=$(PWD)/drivers/video modules
    (maybe `make -C /lib/modules/`uname -r`/build M=$(PWD)/drivers/video clean` first )
    EDIT: Meh, that uses your config and won't build that driver... there must be some way though
    EDIT2: Try:
    make -C /lib/modules/`uname -r`/build M=$(PWD)/drivers/video modules CONFIG_FB_VT8623=m CONFIG_FB_SVGALIB=m
    The problem though is, that they might have removed some of the dependencies of the module, so if it doesn't compile, you'll have to recompile the kernel.
    Good thing is though, you can use their .config as base (found in /usr/src/linux-..../.config)
    You can also check if your config "supports" your module by putting it into the kernel source tree, running `make menuconfig` and typing /8623 and pressing enter.
    The last line in that screen should read:
    Selects: <list of options>
    As long as all of those options are either =y or =m, you're good. SVGALIB can be =n because it's part of drivers/video/ and you can compile it together with  your module.
    Last edited by Blµb (2012-03-02 15:14:16)

  • How to compile package which contain class outside the package

    I am writing a JDBC driver.
    I have the following package structure in the folder:
    MyDriver
        |_manager.jar
        |_com
               |_ jdbc
                       |_ HXDriver
                       |_ HXConnection
                       |_ HXResultSet
                       |_ HXStatementIn manager.jar, there is a remote object Interaface(Manager.java) which I need to use inside HXConnection.
    My question is how to compile(or/and how to set the classpath)so that I can compile the 4 classes inside jdbc package.
    I tried this:
    C:\MyDriver>javac -cp .;manager.jar com/hx/jdbc/*.java
    However, this does not work, compiler says it cannot find Manager
    Please help me.
    Cheers

    D:\380 Project\Driver>javac -cp .;manager.jar com\hx\jdbc\*.java
    com\hx\jdbc\HXConnection.java:21: cannot find symbol
    symbol  : class Manager
    location: class com.hx.jdbc.HXConnection
            private Manager manager;
                    ^
    com\hx\jdbc\HXStatement.java:18: cannot find symbol
    symbol  : class Manager
    location: class com.hx.jdbc.HXStatement
            private Manager manager;
                    ^
    com\hx\jdbc\HXStatement.java:20: cannot find symbol
    symbol  : class Manager
    location: class com.hx.jdbc.HXStatement
            public HXStatement(Manager manager){
                               ^
    com\hx\jdbc\HXConnection.java:41: cannot find symbol
    symbol  : class Manager
    location: class com.hx.jdbc.HXConnection
                            manager = (Manager)reg.lookup("manager");
                                       ^

  • How to use custumer DataTagsLibrary for BC4J in the JSP's with Struts Suppo

    I've been looking for a good tutorial to learn very well
    BC4J, DataTags Library for JSP , all with struts support.
    But it's dificult to join all this topics.
    Can someone help.
    If you have any answer for me, plesea send an e-mail to
    [email protected]

    Try these links:
    http://radio.weblogs.com/0118231/ - Look for the Toy Store demo.
    http://otn.oracle.com/sample_code/tutorials/bc4jvsm/content.html - The new Shopping Mall tutorial.
    http://otn.oracle.com/products/jdev/howtos/content.html - The JDeveloper how to list.
    Also, check frequently on the JDeveloper forum here on OTN.
    HTH.
    Thanks, George

  • How to show serial umber for each of the record in a table stating with 1.

    I want to show serial number starting from 1 for each of the row in the table. Is there any why to achieve this in OBIEE answers?

    simple.. take a dummy col and put formula RCOUNT(1)

  • How can i use dlls for running rtc3?

    how can i use the dll libraries to use for the rtc3 software?

    amolchoudhary wrote:
    can anyone please help me???
    How? You provide almost no useful information.
    What is rtc3?
    Why do you think you have to use DLLs?
    What did you try so far that hasn't worked?
    What is it you want to accomplish?
    You see what you ask here is just about the same as if someone would ask you to tell them what screw he needs to fix his car.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to create a DLL for LabVIEW in MatLab

    I want to use MatLab-Code from an M-file in LabView without MatLab. So i decide to use external code in a DLL. Can anybody give me some hints - how to do? (How to create, how to use?)
    Used System Windows 98, LabVIEW 6.1, MatLab 6.1 R12.1
    Thanks

    Hi,
    I use Matlab-Code in Labview and it's don't need create a dll. The LV was a tool, matlab script, you can write your code Matlab here. see the examples of LV.I think the lV 6.1 have.
    Dll it's very complicated

  • How to use VS2005 dlls with jni?

    Hello,
    I have a java application using jni and some dlls.
    Previously this dlls were created using VS2003. Now I want to use VS2005 and I
    encountered some problems.
    Everything is working on my station were I have installed VS2005 but when I try to run the
    application on other station (a test station) is not working.
    I get the following error:
    java.lang.UnsatisfiedLinkError: C:\App\Test.dll: This application has failed to start because
    the application configuration is incorrect. Reinstalling the application may fix this problem
         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
         at java.lang.ClassLoader.loadLibrary0(Unknown Source)
         ......First I tried to search all the dependences and copied all missing dlls from my work station to the test
    station in the application directory. Still not working.
    when dlls were made with VS2003 I had only 3 dependences: mfc71d, msvcp71d, msvcr71d. With this dlls in
    the application directory everything was fine.
    Second I tried to install .Net framework(2.0) and vcredist (VS2005_sp1) but still nothing.
    What I'm doing wrong? Is somebody which is using dlls made in VS2005 with jni?
    Thank you
    ,Dragos

    IIRC, that message means the manifest file in the DLL points to assembly that your computer doesn't have, or it has no manifest file.
    You either need to:
    -recompile using static linking so that it has no dependencies
    -stick the correct manifest in
    -include the entire SxS (site by side) assembly folders with your application (only the ones you're dependent on). These are found in something similar to:
    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86

Maybe you are looking for