Using C++ classes in a third-party shared library

Would be very grateful if someone could help me out with the following problem that I am having (apologies if this has been answered elsewhere but I have been searching the web for ages and can't find a solution )
I have a requirement for a java app to access a C++ class in a third party shared library. To test my solution and illustrate the problem I have developed the following test code.
I am developing on SUSE 11.1 using Suns Java 1.5 and g++ 4.3.2
$LD_LIBRARY_PATH = /home/raughterd/projects/dpa/jnitest:/usr/lib/mpi/gcc/openmpi/lib
First developed a test class library libfred.so
fred.h
#ifndef __FRED_H__
#define __FRED_H__
class fred
public:
void test() const;
#endif // __FRED_H__
fred.cc
#include <iostream>
#include "fred.h"
void fred::test() const
std::cout << "Called fred.test" << std::endl;
built it with the following
g++ -c -Wall -I. fred.cc
g++ -shared fred.o -o libfred.so
Then developed java test application Tester
jnitest.java
class jnitest
static
System.loadLibrary("jnitest");
public native void test();
Tester.java
class Tester
public static void main(String[] args)
jnitest x = new jnitest();
x.test();
both compiled with
javac xxxxx.java
and developed libjnitest.so by
javah -jni jnitest
to produce jnitest.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class jnitest */
#ifndef Includedjnitest
#define Includedjnitest
#ifdef __cplusplus
extern "C" {
#endif
* Class: jnitest
* Method: test
* Signature: ()V
JNIEXPORT void JNICALL Java_jnitest_test
(JNIEnv *, jobject);
#ifdef __cplusplus
#endif
#endif
wrote jnitestimpl.cc
#include <iostream>
#include "jnitest.h"
#include "fred.h"
JNIEXPORT void JNICALL
Java_jnitest_test(JNIEnv *, jobject)
std::cout << "called C++ func" << std::endl;
fred afred;
afred.test();
compiled with
g++ -c -Wall -I. jnitestimpl.cc
g++ -shared jnitestimpl.o -o libjnitest.so
ran the test application
java Tester
which produced
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/raughterd/projects/dpa/jnitest/libjnitest.so: /home/raughterd/projects/dpa/jnitest/libjnitest.so: undefined symbol: _ZNK4fred4testEv
     at java.lang.ClassLoader$NativeLibrary.load(Native Method)
     at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
     at java.lang.Runtime.loadLibrary0(Runtime.java:822)
     at java.lang.System.loadLibrary(System.java:993)
     at jnitest.<clinit>(jnitest.java:5)
     at Tester.main(Tester.java:5)
Without the references to the fred class in jnitestimpl.cc everything works fine. It is only when I try to use the fred class in the jnitestimpl.cc that I get the exception. I am guessing that it is something to do with the name mangling and maybe compiler options but that is just a guess. ( libfred.so and libjnitest.so are in the current directory which is on the LD_LIBRARY_PATH )
Any ideas? Any help would be greatly appreciated
Many thanks

Forget guys. I was being a complete and utter idiot!! It was compiler options. Forgot the -lfred when building the libjnitest.so

Similar Messages

  • I purchased my iMac using the same (and only) Apple ID I use to purchase apps. Third-party apps update fine, but the apps that came with my iMac (iPhoto, iMovie, etc) bring up a message saying I have to log in with the account I used to purchase them.

    I used my only Apple ID to purchase my iMac (Intel-based one).  I've never been able to update core apps that came with it.  I can update third party apps I've bought (like Coda), but when I try to update Garage Band, iPhoto, iMovie and so on, a popup message appears saying "You have updates available for other accounts" and "Log in with the account you used to purchase this app in order to update it", or similar (see screenshot above).
    The OS seems to get its updates fine - it's just the core apps from the App Store.
    I've only ever had one Apple ID, so I have no idea what to do.  I went to ask the Genius bar at my local Apple store, and they couldn't help, and insisted that I must have purchased the iMac using a different account, but I definitely didn't.  There are a few posts on non-Apple forums of this happening to other people, so it must be a rare bug.
    I'm a little concerned it may affect my ability to update from Lion to Mountian Lion.  Can anyone help?
    Dan

    Have you done a Disk Repair and a Disk Permissions Repair?
    If that doesn't resolve the problem I would suggest calling customer support about this issue as it is most likely on their (Apple's) end that the problem exists. 

  • Using Weblogic MDB to consume message using a XA transaction with third party JMS Provider

              I understood from the WebLogic documentation that we can invoke a third party JMS
              using its XA interface from within a MDB where transaction-type is Container and
              trans-attribute is Required. Also we will need to specify its XAConnection factory
              name as connection-factory-jndi name. It that sufficient ?? Or do i need to set
              up some other attributes also ??.
              

              Hi Neeru,
              I understand u were able to solve this issue.
              I am using similar kind of configuration but instead of tibco i am using Webmethods.
              Could u please let me know what did u do to solve the problem?
              -thanks and regards.
              Praveen
              "Neeru Munjal" <[email protected]> wrote:
              >
              >Hi Rob,
              >I used the same whitepaper and tried to use TIBCO JMS with Weblogic server),
              >I
              >started with MDB example specified in Weblogic 7.0 release in examples/ejb20/message
              >and modified it to use trans-attribute as Required. Also I used connection
              >factory
              >which supports XA, but my MDB does not get called.
              >
              >Thanks & Regards
              >Neeru
              >
              >Rob Woollen <[email protected]> wrote:
              >>Here's a white paper about integrating 3rd party JMS providers with
              >WLS:
              >>
              >>http://dev2dev.bea.com/resourcelibrary/whitepapersdetail.jsp?highlight=whitepapers&filePath=components%2Fdev2dev%2Fresourcelibrary%2Fwhitepapers%2Fwp_jmsproviders.htm
              >>
              >>-- Rob
              >>
              >>Neeru Munjal wrote:
              >>> I understood from the WebLogic documentation that we can invoke a
              >third
              >>party JMS
              >>> using its XA interface from within a MDB where transaction-type is
              >>Container and
              >>> trans-attribute is Required. Also we will need to specify its XAConnection
              >>factory
              >>> name as connection-factory-jndi name. It that sufficient ?? Or do
              >i
              >>need to set
              >>> up some other attributes also ??.
              >>>
              >>
              >
              

  • How to use message queue for inegrating third party with EBS

    Hi Experts,
    We would like to integrate a third party system with EBS using message queues.
    Where we will subscribe to a businnes event and which will populate the messages to messages queue.
    But how can we deque this message in third party systems. We are in R12.1.3 and no FMW installed.
    Any adapater or something is availabe, If so please throw some inputs.
    Thanks
    Bhaart

    Please go to the link
    http://developer.novell.com/extend/composer/1006.html
    and also see the "message filtering" section.
    Where you can find
    Exposing message selection hints in the header portion of a message is a common tactic when multiple receiving apps are pointed at the same queue. The application that is best suited to handling a given message type can harvest just the messages it needs, while other applications can act on messages better suited for them. Administratively, it is more efficient to set up one queue (with multiple receivers accessing it) than to set up multiple queues, each with a dedicated receiver. My question is how can I achieve this Via progamatically ?

  • What are the restrictions/limitation in lookout with the use of graphs created in third party software? When we use these kind of graphs we normally loose resolution, shadows or 3D effects.

    We don't know exactly how does lookout handle .bmp or .wmf files created in third party programs like CorelDraw, since we have a different response from lookout to those graphs. We loose the shadows effects, we don't have a transparect effect, etc.
    Thanks in advance, any help is welcome.

    It shows Peter's doing its jobs properly.
    Anyway there is no more communication from Sony since awihle. If you can have any news.
    Anyway good job Zero!

  • Third Party Modules (Library | Develop etc.)

    Besides the ability for developers to build plugin extensions (the ones with the .lrplugin extension which are widely called modules as well and reside in a module directory unfortunately), I would like to see the possibility to have third party modules that extend the currently builtin Library | Develop | Slideshow | Print | Web panes. Things that I could imagine (either being implemented by Adobe or a third party):
    A Photomerge module (for creating panoramic images as in Photoshop)
    A HDR module (again, as in Photoshop)
    A GEO module that lets you geotag photos (from a tracklog or by dropping on a map), that displays a little map with the track and picture locations (yes, I am talking Aperture here)
    Alternative publishing modules (Photobook, Web)
    And many more...
    There would be several benefits in my opinion:
    Some of the outlined functionality does not fit very good into one of the existing modules, requires a different screen layout then offered, or is very specific and would hence justify its own module
    Functionality that seems not a top priotity to Adobe but requested by enough users could be implemented by a third party (geotagging for examle)
    By offering more modules with selective disabling of whole modules, different customers with different needs can shape their optimal environment. No more discussions whether this and that is a pro or a cosumer feature and should be part of Lightroom. Let third parties develop a face recognition module if someone sees a market for it. Let the pros ignore it and the consumers happily enable it. Let those people diable the builtin Web module that do not need it because they do not wnat or have a simpleviewer flash site.
    Adobe can offer different versions of Lightroom (as done with other software) or sell addon module seperately.
    Just a thought...

    mathmeye wrote:
     Just a thought...
    And a very good thought indeed, me-thinks...
    Many of us plugin writers are chomping at the bit for tighter integration with Lightroom.
    As it stands, there's a pretty big wall between plugins and Lightroom proper (e.g. they have to be contained in modal dialogs (those that blink if you try and do anything with Lightroom before dismissing the dialog) with limited interface to Lightroom...)
    Although I can imagine the challenges in exposing more of Lightroom's guts to plugins, I hope Adobe sees to move in that direction.
    +1 vote...
    Rob

  • Can I use Oracle IPM with a third party content managemen system?

    Hello,
    Our client has a requirment to use Oracle IPM with a non-Oracle content management system. That is they don't want to Oracle UCM. Is it possible? If yes, can you please direct me to some kind of documentation.
    Any help is greatly appreciated.
    Regards
    Abhishek

    I think you should draw a scheme of your architecture for yourself.
    An A/P solution consists of:
    - scanning (hence, ODC/ODDC)
    - repository of images (IPM based on UCM)
    - workflows (BPM as a part of IPM license)
    - connector to an application (usually, Oracle EBS Adapter is used here)
    If you don't intend to use any part of the solution (e.g. you have a different ERP system than EBS, you have your own repository), you can replace it with your own parts. However, be aware that you will have take care of the integration - Oracle can integrate for you only those parts that Oracle has under control (ODC is integrated to UCM/IPM, IPM/UCM is integrated to EBS, workflows know how to call UCM/IPM services). Of course, it uses open standards (web services or RIDC), so you may implement the integration yourself.

  • Class conflicts with third-party libraries on j2ee engine

    Hi,
    I am deploying a repository manager into EP. In my repository I referenced javax.xml.namespace.QName, which conflicts with the one declared in jaxrpc.jar in j2ee/cluster/server0/bin/ext/webservices_lib.
    I am not very clear about how NW j2ee engine loads classes, but it seems that it loads classes in j2ee/cluster/server0/bin/ext/webservices_lib first. As a result, I got a class confliction error:
    java.lang.NoSuchMethodError: javax.xml.namespace.QName.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    If I remove QName.class from the jar in webservices_lib, it works fine, but this not the right way. I have read Note 990854, but not clear about how to do. Could anyone give any help?
    Thanks,
    Ray

    Close this thread as it makes little sense.

  • Determine MWST using fiscal class of ship-to-party

    Hi,
    Can you tell me how to make the system determinate MWST condition by the fiscal classification of the ship-to-party?
    I create an acess sequence with filed KOMK-TAXK1, but this is the fiscal classification of the sold-to-party except if the ship-to-party has a VAT Registration Number. But what I want is that an acess sequence always by the  fiscal classification of the ship-to-party.
    Can you hepl me?
    Thanks in advance
    Dora

    Hi,
    Go to VK11, select UTXJ and maintain the tax code for ship to party for your customer.
    Basically the idea to maintain the tax code which has the relevant registration number.
    If the priority has been given to the sold to party, then what i can suggest alternatively, you can add the tax number of ship to party, while removing the tax number of sold to party.
    thats all i know, see if it helps you.
    regards,
    Siddharth

  • Third party Messaging library for MIDP 1.0 phones

    Hi guys,
    Does anybody know any 3rd party library for MIDP 1.0 platform?
    Actually, I mean MIDP 1.0 without WMAPI.
    Thnx.

    there is a possibility (but the phone will not send the sms):
    send a text to a server, the server will send the sms and returns the status of the send!
    or decompile i-mode api to see how they did it!

  • Question about using third party jar files in Java Web Start Environment

    Hi everybody, I got a very strange problem and still can't figer out how to solve it. Can anyone help to overcome this problem?? Thanks in advance.
    Question: I wrote a simple java swing application to connect to Oracle database. I packed whole my classes and a third party jar file(classes12.jar) to a new jar file named "IRMASSvrMgntGUI.jar" and then use command 'jarsigner' to signed IRMASSvrMgntGUI.jar. There is no problem when I execute 'java -jar IRMASSvrMgntGUI.jar' in the command line. But when I execute this application via Web Start Environment, an "java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
    " error occured with the following detail log shown in Jave Web Start Console:
    =============================================================
    java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
         at DBConnection.getNewConnection(DBConnection.java:25)
         at IRMASSvrMgntGUI.actionPerformed(IRMASSvrMgntGUI.java:524)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    ==========================================================================
    contents of the manifest file I used to create this jar file are as follows
    ===================================
    Manifest-Version: 1.0
    Main-Class: IRMASSvrMgntGUI
    Class-Path: classes12.jar
    Created-By: 0.9a (itoh)
    ===================================
    and file structures in "IRMASSvrMgntGUI.jar" is
    ====================================
    META-INF/
    classes12.jar
    DBAuthenticateDialog.class
    DBConnection.class
    IRMASSvrMgntGUI.class
    ====================================

    If you directly include classes12.jar in IRMASSvrMgntGUI.jar, the classloader won't be able to find the classes inside classes12.jar. You should sign classes12.jar separately and include that in jnlp along with your application specific jar. When you're launching your app using "java -jar somefile.jar" then the classpath settings in manifest file are used, but that's not the case when you start using JWS since in this case the classpath is based only on the " <jar href=..." entries in jnlp.

  • Using Third Party Libraries in J2ME IDEs

    How easy is it to use functions from a third party library in J2ME IDEs? Is it usually just a matter of including the library or is more configuration involved?
    Thanks for your time.

    I had this problem a year ago. I'm surprised it hasn't been fixed yet. Here is what I had to do to create an external library DC for my third-party apis.
    - Create a java library DC.
    - Switch to resource view
    - Edit .dcdef to change component type to Library
    - Edit .project file, Delete Nature Java line
    - Restart IDE so that it shows as Library DC instead of Java
    - Switch to Resource View
    - Get all the third-party jar files into folder structure com
    - Copy and past the root folder into src (this would bring all class files)
    - Add build.vm in cfg folder (content #BuildSecondaryLibrary())
    - Add Public Part for API Reference (the IDE should allow to add the all the classes from the selected folder. You probably will have to select each classes manually. Very problematic when you have a lot of classes from your third-party provider)
    - Build and Deploy
    - Now go to your other project where you want to refer this external library DC
    - Add to the external library DC as used DC (select build and deploy options)
    - Build and Deploy
    - Make sure provider.xml in the sda file has reference to dfc lib (for some reasons the IDE doesn't want to reference the external library DC and just skip it despite the fact that you've selected build and deploy options when you referenced the used DC)
    - If not extract the SDA file, Edit the provider.xml, and zip back. then Build and Deploy

  • Is it possible to use Fingerprint recognition in iOS7 in third party app?

    We are trying to develop an app which need to include Fingerprint recognition in iOS7. We searched lots of communities to find the solution, but haven't get any correct information. Somewhere written that the Fingerprint recognition only use in native app in iPhone 5S. But we can not use that hardware (Home button)/api in third party app. I am not confirmed yet. So is it possible to use that functionality in a third party app development?

    hi friend,
    i am facing problem with my fringerprint machine.i dont have any idea how to connect that macine with my system and how to extract that fingerprint machine data in to my application witch is build up into Apex.
    i want to use fingerprint machine to manage Employee Daily attendance.But i dont know how can i do this in apex.
    if you have any idea please help me
    Thanks
    Manoj Kaushik

  • With Muse, can you use In-browser editing of websites using Third-party Hosting Service Providers or not?

    On this page:http://www.adobe.com/inspire/2013/12/in-browser-editing-muse.html, it says you must use Adobes hosting. On this page: https://helpx.adobe.com/muse/using/in-browser-editing-websites-third-party-hosting.html, it indicates you can purely from the title. Which is it?

    Hi Bob,
    I found out how to do it, you drag the bounding box of the image container or rectangle to the edge of the browser boundary - as in the gray area around the edge - it snaps to it and the edges of the container go red to show this, and when its previewed it spans 100% of browser width. This video from Lynda explains how:
    Creating the header and the footer (Updated) from the Course Designing a Portfolio Website with Muse
    I can't upgrade as I have windows vista and the new version doesn't run on Vista, don't really want to buy a new computer just to run the latest Muse!
    Cheers!

  • Anyone else have difficulty using third party software and websites with the new MacBook Pro with retinal display?

    I just returned my new Mac book pro with retinal display after three very disappointing three weeks of trying to use certain websites and other third party programs (Quickbooks, Raintree) that would not function properly.  My husband own the previous MacBook Pro version with the built in CD rom and I was able to use those above mentioned websites and problems with the no difficulties.  Did I just happen to get a lemon or is this a function of the computer being too new for third party software?

    Programs such as Quickbooks pro for Mac, I was able to import my previous data and I was able to enter about 5 new transactions before it stopped being able to save transactions.  Other programs ( Raintree ) that I use via VM software as a windows based program I was able to access and use some features but not others.  On the web browsers (both safari and Mozilla) I use a website that has an analyzer feature and it would pull up a blank screen in the place where I would enter pertinent information.  They tried pulling this website at the apple store today and the same issue happened.  All these programs and website I am able to access and run smoothly with no issues on my husbands MacBook Pro , which is why I returned my MacBook.  I just wondered if others were experiencing similar issues with their MacBook with retinal display. 

Maybe you are looking for