Creating shared library of native method implementation using gcc

Hi
I am using Dev-C++ IDE for writing and compiling C Programs. It supports gcc.
I have to build a shared library of a native method implementation using gcc compiler.
In JNI tutorial build script is given for VC++ which is as follows
cl -Ic:\java\include -Ic:\java\include\win32
-LD HelloWorldImp.c -Fehello.dll
Similarly I wanted build script for gcc compiler.
Thanks
Shailesh

Here is an example of building a library from one module with CygWin's gcc:
# Must set JAVA_HOME and LIBRARY_MODULE before
gcc -mno-cygwin -D__int64="long long" -I $JAVA_HOME/include/win32 -I $JAVA_HOME/include -shared -Wl,--kill-at -o $LIBRARY_MODULE.dll $LIBRARY_MODULE.c

Similar Messages

  • Compilation error in creating shared library via JNI

    Hi ALL,
    I amin serious trouble with a problem. I am developing a Simulator, a function of which is to decode MPEG-2 Video files in real time and play it as well.I have got a MPEG-2 Decoder implemented in C from an open source and need to integrate with my Simulator which is writtebn in Java. The integration part I am doing via JNI(Java Native Interface). Now I have a bunch of C files in MPEG-2 decoder which are to be compiled during the Execution of the Java Simulator.Can anybody give some idea about how to call multiple C files from the Java Source through JNI at one go? Another problem I am facing is in calling a single C code from the traditional "HelloWorld" Java Code itself. The problem comes when I am trying to compile the shared library between the C native code and Java Code in my Linux Machine...I am getting the following message:
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/.../../../crt1.0 : In function '_start' :
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/.../../../crt1.0(.text+0x18): undefined reference to 'main'
    collect2: ld retrurned 1 exit status
    What does the above errot mean? How to rectify it.It will be of great help if you anybody can give me clues.

    It means that your compiler options are wrong.
    You need to create a shared library.
    Instead you are creating an executable, which is not the same as a shared library.
    If you search this forum you will find posts with command line options that work.

  • UnsatisfiedLinkError,   Load Library Successfully, Native Method Not Found

    I am using JNI to call a ".dll" file I made on windows.
    I got the exception:
    Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: com.aspectgaming.core.io.JniInnocore.Dpci.waitEvent(Ljava/lang/Object;J)I
    at com.aspectgaming.core.io.JniInnocore.Dpci.waitEvent(Native Method)
    at com.aspectgaming.core.io.JniInnocore.IDLPThread.run(IDLPThread.java:19)
    at java.lang.Thread.run(Unknown Source)
    The code for loading c dll library:
    URL url = Thread.currentThread().getContextClassLoader().getResource("");
    String baseClassPath = url.getPath();
    System.load(baseClassPath "com/aspectgaming/libjnidpcicore.dll");+
    The  ".dll"  file is already loaded,  because when I changed the dll file name to any other ones,  a "library file not found" exception will be caught.
    The problem is Dpci.waitEvent and all the native methods could not be found.
    I used a PE viewer to view the dll exports I got:
    Export table
    Characteristics=0, TimeDateStamp=1237366066, MajorVersion=0, MinorVersion=0, Name=36994, Base=1, NumberOfFunctions=9, NumberOfNames=9, AddressOfFunctions=36904, AddressOfNames=36940, AddressOfNameOrdinals=36976,
    TimeDateStamp:Wed Mar 18 16:47:46 GMT+08:00 2009
    Java_com_aspectgaming_core_io_JniInnocore_Dpci_getEventName@12 (Ordinal: 1, Entry Point RVA: 147ah (5,242))
    Java_com_aspectgaming_core_io_JniInnocore_Dpci_getNumOfEvents@8 (Ordinal: 2, Entry Point RVA: 11a5h (4,517))
    Java_com_aspectgaming_core_io_JniInnocore_Dpci_getNumOfInputPorts@12 (Ordinal: 3, Entry Point RVA: 1789h (6,025))
    Java_com_aspectgaming_core_io_JniInnocore_Dpci_getSramSize@8 (Ordinal: 4, Entry Point RVA: 1190h (4,496))
    Java_com_aspectgaming_core_io_JniInnocore_Dpci_readEvent@12 (Ordinal: 5, Entry Point RVA: 11bah (4,538))
    Java_com_aspectgaming_core_io_JniInnocore_Dpci_readPort@12 (Ordinal: 6, Entry Point RVA: 17a7h (6,055))
    Java_com_aspectgaming_core_io_JniInnocore_Dpci_waitEvent@20 (Ordinal: 7, Entry Point RVA: 14b8h (5,304))
    Java_com_aspectgaming_core_io_JniInnocore_Dpci_waitIOPort@24 (Ordinal: 8, Entry Point RVA: 17dbh (6,107))
    Java_com_aspectgaming_core_io_JniInnocore_Dpci_writePort@16 (Ordinal: 9, Entry Point RVA: 182ch (6,188))
    The java class "Dpci" is exactly in this package : com.aspectgaming.core.io.JniInnocore;
    I compiled it by gcc on linux as a ".so" file and everything is working on linux.
    On windows I am compiling this by Mingw gcc.
    Here is the make file on Windows which is used by Mingw32-make:
    dpci_core:
    gcc -o ../../../java/com/aspectgaming/libjnidpcicore.dll -shared -IC:\jdk1.6.0_10\include -IC:\jdk1.6.0_10\include\win32 -I'D:\Program Files\Innocore Gaming Ltd\DirectPCI SDK & Run-time\include' dpci_core.c libdpci_static.lib
    dpci_core.c is my code file and  libdpci_static.lib is the library that my c dll will depend on.
    Any thought to this UnsatisfiedLinkError exception problem?
    Thanks!

    I recompile my codes under visual c++ 2008 express on Windows XP professional, and I have already got rid of this problem.
    But when I move the compiled java jar application to windows xp embedded edition, an exception will be caught:
    C:\AspectGamingCore>java -jar Aspect.jar
    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\AspectGamingCore\l
    ib\libjnidpcicore.dll: This application has failed to start because the applicat
    ion configuration is incorrect. Reinstalling the application may fix this proble
    m
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.aspectgaming.core.io.JniInnocore.Dpci.loadLibraryOnWindows(Unknow
    n Source)
    at com.aspectgaming.core.io.JniInnocore.DpciTest.main(Unknown Source)
    I don't know if there is any compatible problem bewteen xp and xpe but one possible reason is that xpe may be lack of some dll files like msvcr90.dll.
    So I tried to compile the dll as static library in vc++2008, but this does not run even on my winxp professional:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\AspectGamingCore\l
    ib\libjnidpcicore.dll: %1 is not a valid Win32 application
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.aspectgaming.core.io.JniInnocore.Dpci.loadLibraryOnWindows(Unknow
    n Source)
    at com.aspectgaming.core.io.JniInnocore.DpciTest.main(Unknown Source)
    Could JNI call a c static library? Why it says "not a valid Win32 application"?

  • Create shared library on external drive from scratch

    I have seen many posts about creating shared iTunes libraries on external drives with many different configurations, but mostly with pre-existing libraries. My question is creating the library from scratch. The purpose is obviously to share songs among several computers AND only have one copy of a song as to not take up unnecessary disk space on several computers.
    All of our songs are on an external USB hard-drive attached to Airport Xtreme. Every song is in album folder, and every album folder is in an artist folder (very organized). All the artist folders (with their album and then song contents) are in a root folder called "Songs" on the external hard-drive.
    We have upgraded our three Macs (iMac, MBP and MacMini) to Leopard and deleted all iTunes folders on each local hard drive (there was nothing in them anyway). We now want to create ONE iTunes folder on the hard drive so that each computer can access it. What are the steps? Here is what I "think" I've learned here on the postings with my questions:
    1) First I opened iTunes on my first, main computer (iMac) and went into "Preferences" to change the iTunes music folder to [Ext HD]:iTunes:iTunes Music. The option, "Copy to music folder..." is deselected. (This will also be done on the other computers).
    2) Now what to do? I could just move all of my song artist folders with their album subfolders and music files inside them, into the "iTunes Music" folder. But then what do I click to get iTunes to see all the songs and put them in its database? The other option is click "Add to Library" - but then don't I have to select all the individual songs? (I actually tried the latter method and it kept crashing). Can I just move all the folders into [Ext HD}:iTunes:iTunes Music folder and click something to get it to create its database based on all the music files that are now in its subfolders?
    3) Next step. I have seen many people write that they then create an "Alias" and put the Alias in their "Music" folder on their LOCAL, computer's hard drive. Could someone now explicitly, step-by-step, describe how this is done? I assume I go to the external hard drive. Am I creating an alias of the entire "iTunes" folder, or of the "iTunes Music" subfolder, or of the library file??? Please answer this specifically.
    So now I have "XXX alias" that I copy to my local, computer's hard drive and put it on my desktop. I take out the "....alias" word, and drag it to my local "Music" folder. It asks me to replace the existing folder/file, and I say yes. Correct? And then I do this on all three computers, correct?
    4) Finally, after I've done all of this, I still have the following functionality questions -
    4a) When we now add to the library, either from a CD or online purchase, ONE copy of the music should go in the "iTunes Music" folder on the external drive, correct?
    4b) This system means that all three computers MUST have the same iTunes library, playlists, etc, correct? The downside of this system is that you cannot personalize libraries for each computer and just share the actual music files, correct? (If so, is there another process [steps 1-4 above] that results in a more customizable system where *ONLY ONE COPY* of the actual song file is shared?)
    Sorry for the length of the message, and the questions. Truly I have read all the postings but was unable to map out my plan before I go and creating, finally, this one set of music that we can share. In advance, thank you all for your help.

    I was afraid you'd say that, because I'm a long time Mac guy and I don't have the perfect answer. Have you ever messed with remote desktop? That'd seem to give her full access and control, something I personally wouldn't do, although it may work for you.
    Another thought came to me that might work: copy over the complete library to her machine, and then when you do another major shoot, create a new catalog, edit, etc.and then import as catalog to you main one while sending her the new one.
    I am sure there are more elegant solutions, but these are a couple of ways.

  • Linux Cannot Create Shared Library to call from Labview. Anyone have any ideas?

    Hi there.  A while back i created a shared library (.dll) to call in labview which works great.  Lately i have been using Linux more and more and was hoping to recompile the shared library for use in Linux Labview.  My first go I am getting the following error #error "Unknown Linux platform"   from the platdefines.h.   Evidently it does not like my system.  Using QT creator on linux mint 64 bit.   Anyone have any ideas on how i can get this working?
    thanks so much!

    I have a few version questions: What version of Windows was this DLL orignally created in? What version of LabVIEW are you using? What version of Linux are you using? 
    I think you will also find this previous discussion forum thread useful: http://forums.ni.com/t5/LabVIEW/Calling-DLL-on-LabVIEW-for-Linux/td-p/58322

  • How create shared Library for JNI

    Please tell me how to create a shared Library for vc6.0. I have created <.h> file of java class. Please Help me.

    This is a duplicate of
    http://forum.java.sun.com/thread.jspa?threadID=676996

  • Create Shared Library for toplink.jar

    I have followed the "How-to: Swap Oracle JDBC Drivers" http://www.oracle.com/technology/tech/java/oc4j/1013/howtos/how-to-swapjdbclib/doc/readme.html and try to do the same for toplink.jar.
    However, when I check with the call oracle.toplink.Version.getVersion() it still return that I'm using 1013 DP4 toplink.
    From the post in Toplink forum Re: Change Toplink library version used on 1013 DP4 it seems that it is difficult, to use another toplink version in 1013 DP4...
    I would like to confirm if that's the case? Any other methods I can try?

    This is a duplicate of
    http://forum.java.sun.com/thread.jspa?threadID=676996

  • Method implementation using ABAP objects

    hi folks,
    I am impelementing a method using one of the parameters, which is a internal table taken as an import parameter.
    I am using the field symbols to <b>modify</b> the table data  but it is not working.
    method IF_EX_PT_ABS_ATT_COUNTRY~CALCULATE_COUNTRY.
    The method CALCULATE_COUNTRY has a parameter
    TIMES_PER_DAY Importing TYPE PTM_TIMES_PER_DAY.
    This is the table tha t retrieves the data for the Absence infotype 2001 for an employee and has the field
    ABRST value populated.
    I need to clear the value for this field and update the table 'TIMES_PER_DAY' before it populates the infotype record.
    Hence I am writing the code in its method by calling the parameter.
    here is the piece of code....
    FIELD-SYMBOLS: <F1> TYPE PTM_TIMES_PER_DAY.
    loop at times_per_day into <F1> where datum eq begda.
       clear <F1>-abrst.
       ASSIGN <F1> to times_per_day.  ****ERROR
    endloop.
    endmethod.
    I know the error is because trying to assign the <F1> field symbol to internal table.
    But how can I do that ultimately I need to update the internal table 'times_per_day '
    ALSO TRIED THIS....
    data: w_tab type PTM_TIMES_PER_DAY.
    loop at times_per_day into w_tab where datum eq begda.
       CLEAR w_tab-abrst.
       modify times_per_day from w_tab transporting abrst.
    endloop.
    It gave an error saying the table 'times_per_day' cannot  be changed.
    I hope you got what I am trying to achieve here... any leads or guidelines will be really helpful,
    Thanks
    Vinu

    Is this table part of the IMPORT PARAMETERS  list. If that is the case you cannot change the table.
    It should be in the EXPORTING parametes to change.
    Regards,
    Ravi
    Note : Please mark all the helpful answers

  • How to create a c++ shared library (.so) for linux real time (for myRio) with Eclipse to use in LabView?

    I tried already these Tutorials and Advices but I didn't find a solution:
    - http://www.ni.com/tutorial/14625/en/
    - http://www.ni.com/tutorial/14690/en/
    - http://forums.ni.com/t5/LabVIEW/Shared-Library-on-myrio-Linux-Real-time-system/m-p/2842540/
    - http://forums.ni.com/t5/LabVIEW/How-to-create-shared-library-for-linux-real-time-target-in/m-p/28218...
    - and some more
    I want use c++ codes on linux real time. For testing reasons I want to have a function that adds 2 values and gives the result.
    I've done these steps:
    1. writing a c++ file in Eclipse (see screensot 2)
    2. building a shared library (.so) from my c++ project in Eclipse (with Cross GCC)
    3. putting this file on myRio (path: /usr/local/lib/)
    4. creating a VI that calls this library from Labview with a "Call Library Function Node" (see screenshot3)
    5. Setting the properties for the "Call Library Function Node" (see screenshots 4-7)
    After I run this VI i get this error message: LabVIEW:  (Hex 0x627) The function name for the ... node cannot be found in the library. To correct this error, right-click the Call Library Function Node and select Configure from the shortcut menu. Then choose the correct function name. (see screenshot1)
    I've tried a lot things to solve this problem but I couldn't find a solution. Would be very happy if anyone can help me. I guess that I have to edit my c++ code to export my function (symbol). But I have no idea how to make it. I also tried it with a dll file in the same folder but it didn't help.
    Perhaps someone can send an example which works on myRIO.
    Thanks!
    screenshot1
    screenshot2
    screenshot3
    screenshot4
    screenshot5
    screenshot6
    screenshot7

     can see it in the screenshot8 there is a function called "_Z8AddierenddPd" instead of "Addieren". I copied this name to Labview (see screenshot9) and it worked.
    I'm sure that there is a way to compile the shared folder with gcc without decorations (mangling). But I don't know how. If someone has a recommendation I would be very glad!
    Prepend each function declaration that you want to be available without name decoration with
    extern "C" <your function declaration>
    Or if you have multiple functions you want to export you can in the header file where you declare your functions simply use:
    #ifdef __cplusplus
    extern "C" {
    #endif
    <all your function declarations>
    #ifdef __cplusplus
    #endif
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to configure Class Loading-Import Shared Library using admin_client

    i am deploying ear using below command through command prompt.its deployed successfully.
    java -jar ../admin_client.jar deployer:oc4j:localhost:23792 oc4jadmin oc4jadmin -deploy -file C:/ex.ear -deploymentName ex -bindAllWebApps
    i have one requirement if i deploy thorugh command prompt. while deploying ear through admin console in Deploy: Deployment Settings-Configure Class Loading-Import Shared Libraries-i checked JAXB then the ear will be deployed successafully.
    i need to incorporate same thing in above command also.i have created shared library and jars are placed in this path.
    C:\Oc4J\j2ee\node1\shared-lib\JAXB\2.0
    but while deploying ear using admin_client.jar command script i need to configure classs loading and import above shared library.how to modify the script?

    Ours is not a Desktop Application, but we want to handle Authentication(Which authenticates the userid and password by making a Tuxedo call) and add the Principal to Subject in session, so that ADF Authorization and securityContext can be used as is,
    but doing this with Custom Authentication Provider in weblogic needs me to have a lot of Tuxedo Service related jars in weblogic/system classpath which i feel is not right thing to do, as the same jars are required in application also, which means i will have the jars in class path twice and i need to deploy the jars to both places everytime there is any change.
    Is there any way by which i can set Authenticated principal to Subject in the created session from within Application?

  • How can I use a shared library made with the application builder?

    Hi,
    I am using LabVIEW 7.1 running on Slackware 10.1 (kernel 2.4.29) and I am trying to call a graph display from a C program that I use for debugging VME access from a VMIVME controler. So using the application builder I built the VI as a shared library (graph.vi -> graph.so) containing a function called "graph". In my main program the call to the dlopen fails with the error: "graph.so: undefined symbol: UninitLVClient". When I examin graph.so with nm I see that UninitLVClient and other LabVIEW functions are indeed undefined and using ldd shows that graph.so has dependencies only on libc.so.* and *linux*.so.* but not on LabVIEW related stuff. Those functions are defined in the liblv.so that's in the cintools directory but I have no idea if the user is supposed to use that.
    So I think I am missing an important concept here. Can somebody help or direct me to some documentation (I found lots of information about how to link external code to LabVIEW but nothing about how to link LabVIEW code to an external program)?

    Thanks Watermann,
    your message has been very useful so now I am linking to the proper library but I still have problems when trying to load dynamically the shared library produced with LabVIEW. It is strange that I could successfully load the lvrt library at loading time but it does not work when I am loading the library at execution time.
    I made a small LabVIEW program that prints a hello window and I am calling it from a C program. In the first program main.c I am linking to the lvrt library at loading time and it works but in the second one I am linking dynamically at execution time and it does not work. For my work I need to be able to load code done in LabVIEW at execution time. Any help is appreciated!
    Program main.c:
    // small program to call a LabVIEW shared library
    #include
    #include
    #include "hello.h" // got this from the LabVIEW builder, i.e. when I made the hello.so
    int main(void)
    printf("Hello from C!\nLets call LabVIEW now\n");
    hello();
    printf("Bye ... \n");
    return 0;
    The command to compile main.c, i.e. linking shared library lvrt when loading main program:
    gcc -Wall -I /usr/local/lv71/cintools/ -o main main.c hello.so -l lvrt
    The LD_LIBRARY_PATH has been defined and exported:
    $ LD_LIBRARY_PATH=$PWD
    $ export LD_LIBRARY_PATH
    IT WORKS!
    Program main2.c:
    // small program to call a LabVIEW shared library
    #include
    #include
    #include
    int main(void)
    void * h_lvrt;
    void * h_hello;
    void (* hello)(void);
    char * error;
    printf("Hello from C!\nLets call LabVIEW now\n");
    // open LabVIEW RunTime shared library
    // in my computer located at /usr/local/lib/liblvrt.so
    h_lvrt = dlopen("/usr/local/lib/liblvrt.so", RTLD_NOW);
    // check for error
    error = dlerror();
    if (error) {
    printf("error : could not open LabVIEW RunTime library\n");
    printf("%s\n", error);
    return 1;
    // open hello shared library
    // in my computer located at /home/darss/lv_call/hello.so
    h_hello = dlopen("hello.so", RTLD_NOW);
    // check for error
    error = dlerror();
    if (error) {
    // close LabVIEW RunTime shared library
    dlclose(h_lvrt);
    printf("error : could not open hello library\n");
    printf("%s\n", error);
    return 1;
    // get function hello from library hello.so
    hello = dlsym(h_hello, "hello");
    // check for error
    error = dlerror();
    if (error) {
    // close hello shared library
    dlclose(h_hello);
    // close LabVIEW RunTime shared library
    dlclose(h_lvrt);
    printf("error : could not get the hello function\n");
    printf("%s\n", error);
    return 1;
    // call hello function
    hello();
    // close hello shared library
    dlclose(h_hello);
    // close LabVIEW RunTime shared library
    dlclose(h_lvrt);
    printf("Bye ... \n");
    return 0;
    The command to compile main2.c, i.e. dynamically linking library lvrt at execution of main2 program:
    gcc -Wall -o main2 main2.c -l dl
    The LD_LIBRARY_PATH still defined and exported.
    IT DOES NOT WORK!
    Program output:
    Hello from C!
    Lets call LabVIEW now
    error : could not open hello library
    /home/darss/lv_call/hello.so: undefined symbol: WaitLVDLLReady

  • How to Provide Native Methods in an Executable?

    Hey there,
    I'm writing a native Java launcher as a replacement for java.exe (or eclipse.exe). So far I'm only on Windows NT x64. Things work pretty well: My native executable launches the JVM using the Invocation API and calls a static `main' method.
    Now I thought it was a good idea if my executable could provide the implementations of a few native methods so the `jvm.dll' can communicate with the executable that it was loaded by. This would free me from having to locate and load a shared library at runtime. I expected this to "just work," but alas, it didn't. Providing a simple native method such as
    JNIEXPORT jboolean JNICALL
    Java_com_phrood_kourou_Kourou_available0(JNIEnv* env, jclass cls) {
    return JNI_TRUE;
    in the executable and calling it from Java through JNI, I get an `UnsatisfiedLinkError'. Why is that so? Both the executable and the DLL live in the same process, so shouldn't the C function be found without further concern?
    Then I came up with the somewhat experimental idea and just loaded the EXE file from Java by `System.load(pathToExe)'. I never expected this to work, but---it did!
    That's good news, of course. Only I'm afraid that's a lot more memory-consuming than it needs to be. My EXE file has some 200 KB and counting, and I only need I a handful of small native-method implementations. I could write a DLL, of course, but I'd like to do without an extra file and an extra project to set up and maintain.
    So, my question is: Why do I have to load the EXE into the same process a second time? Is there a more elegant solution?
    Regards,
    -- Phil

    It doesn't work anyway. Although I can load my EXE as a DLL, the newly-loaded image has its own address space, so I cannot use that to call back the EXE.
    I think I can acomplish what I need without a DLL altogether. Hopefully.
    I want the usage of my executable to be as simple as using `java.exe'. Clients should just write a configuration file, rename and start or double-click the EXE and that's it. An MSI would be pointless here, since the usage of the launcher is completely generic.
    More importantly, maintaining cross-platforms C++ projects with Eclipse CDT is possible but a bit of a hassle. I already have two projects: one for the EXE and one for the Java companion Jar. Creating a new DLL project would require me to maintain 3 Eclipse build configurations for Windows, Linux, and Mac; and even another three should I support the x86 architecture. I'd be happy if I could do without.
    What strikes me is that you folks try to teach me what I should do or not do, even call my problem a "nonproblem," rather than just help me out and try to answer my questions. None of the answers here were helpful to me, but I think I figured it out.
    Nonetheless, thanks for taking the time to read and answer.

  • Errors in compiling native method

    I am trying to call a native method from a java source program. I generated header file by javah and wrote c file for native method implementation. I work on RedHat Linux-7.2.
    Java file for native method:-
    class HelloNative
    {  public static native void greeting();
    static
    {  System.loadLibrary("HelloNative");
    Java file for calling native method(main java file):-
    class HelloNativeTest
    {  public static void main(String[] args)
    {  HelloNative.greeting();
    C file implementing native method:-
    #include <stdio.h>
    JNIEXPORT void JNICALL Java_HelloNative_greeting
    (JNIEnv* env, jclass cl)
    {  printf("Hello world!\n");
         I am using following command for compiling c source file:-
    cc -G -I/usr/java/jdk1.3.1/include -I/usr/java/jdk1.3.1/include/linux HelloNative.c -o HelloNative.so
    It gave me followig errors on compiling:-
    cc: unrecognized option `-G'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'
    collect2: ld returned 1 exit status.

    Looks to me like you're not telling the linker to create a library (DLL). I'm not familiar with Linux, but clearly if the linker if looking for 'main' then its trying to build an executable.

  • JNI native method

    Say I create a JVM from native code and use it to popup a GUI... kinda like the next 2 lines:
    res = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
    mid = (*env)->GetMethodID(env, cls, "showWindow", "()V"); // This MID will pop up gui
    Now, how do I make a button int he Java GUI call back down to the native code (C). Is this even possible without creating a shared library and doing System.loadLibrary() ?

    See JNI function RegisterNatives. This lets you put native methods in your main executable rather than needing a shared library.
    -slj-

  • IPhoto 09 facebook integration design botch with shared library

    Like, I suspect, a lot of people with a family Mac we have multiple accounts so we can have our own setup, but we pool all our photos together into a shared library (per Apple's recipe, using a separate volume without permissions) so we can all browse our common photos...after all, the pictures of us our more likely to come from other people's cameras, and vice versa.
    This worked fine in the last version of iPhoto, but the implementation of facebook integration has a serious flaw. The facebook metadata is stored in the iPhoto library (though it seems not the passwords, thankfully), instead of a user's personal directory. This means when I look at the shared library, I see the facebook folders the OTHER users of the mac created, which are unwriteable to me, since of course we have separate facebook accounts.
    This is a design flaw. The facebook folders should be personal info, not visible in the shared library, or (better yet) I should be able to have a shared library for iPhoto and separate personal libraries, then I could make my own choices.

    iPhoto menu -> Provide iPhoto Feedback
    Regards
    TD

Maybe you are looking for

  • FMS web server scheduling error

    following message pops up when generating a schedule for a report. "Scheduling failed! Please set property: server.forward.email.fromAddress under admin --> preferences" Although, all information is provided and the FMS server's Perf collector is res

  • Open script play doesnt work in the clustered env

    We have Clustered Webcenter env. Here, we record our flow in the open script. If we play back as the recorded user, it works fine. However if we randomize the users it fails with the following two errors : 1.Failed to solve variable web.input.wcconte

  • Java.lang.IllegalAccessException using Reflection and SSL

    Hi all, I am getting the java.lang.IllegalAccessException when trying to access the field's value. I'm passing an object that has it's fields set. I'm trying to determine the object passed to my method, get the object's fields, get the field values a

  • Changes in qs21, qs31, qs41, qdv1

    Hi, pls inform what t-codes should be used to see the changes in qm master data like qs21, qs31, qdv1, qs41 etc?

  • I am trying to use IMAQ acquire and other IMAQ functions with Queue functions.

    i am trying to use IMAQ acquire and other IMAQ functions with Queue functions. i mean i would like to acquire the image in a queue and deque it afterwards. would be the queue function accept the IMAQ data type?