Dlopen and unresolved symbols

Hi forum,
I have some .so files, some of them made by me(i.e., I have source files and Makefiles), some of them third party(i.e., I only have the .so file).
I'm trying to create an executable that is able to distinguish which ones are mine and which ones are not. In all my .so libraries I put a function called '_version'.
The problem comes here. When I try to load any of those third party .so, I get this error:
'ld.so.1: home/uf766857/projects/buscaversions/principal/output/versions:
fatal: relocation error: file <file_name.so>: symbol <symbol_name>: referenced symbol not found'
I'm using RTLD_LAZY mode. Is this not enough in order to avoid undefined symbol errors? I only want to check the presence of the '_version' function.
Could anyone help me? (I really need it)
TIA
David.

Hi,
I'm not able to use dlsym() because I'm not able to get a handle to the .so using dlopen().
I found the error using nm. This 3rd .so relies in another .so. I've added this new .so in my Makefile, but this new .so again relies in external symbols. Using nm, I found them inside the 3rd party main executable. How can I link using symbols inside this executable?
Thanks again.
David.

Similar Messages

  • System.LoadLibrary + dlopen -- callback causes unresolved symbol

    Hi guys,
    I am currently trying to use the API
    System.loadLibrary(String name)in order to dynamically link shared libaries to SOLARIS JVM.
    I am facing some unresolved symbol at run-time .
    I load a shared library libhello1 (using system.LoadLibary)
    and I call from this lib (via JNI interface) a method which
    loads a second library libhello2(using dlopen) and invokes hello2().
    hello2 will call back a method hello_bug which is implemented in libhello1.
    There is the a mutual or cyclic dependence. This dependance is correctly handled if I link the libhello1 to a standard C implemented executable.
    But if I load libHello1 via System.Load, the second lib is correctly loaded but the call back is not possible due to unresolved symbol.
    It seems like the symbols are not kept in this case(or the dlopen creates a different thread?...)
    The workaround to fix the issue is to link explicitely libHello1 to libHello2 when building libHello2.
    I don't know if this is clear to everyone so
    I have reproduced this on a very simple case.
    Basicaly, I have implemented in standard C language 2 shared libraries:
    libHelloModule1.so, libHelloModule2.so
    one standard executable and one java interface to call the method
    Below is the full code for reproduce:
    hello1.h:
    #include <dlfcn.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <iostream>
    #include <jni.h>
    #include "hello_jni.h" [u]//automatically generated by javah -- ref Makefile[/u]
    extern "C"  void hello_bug();
    hello1.cc :#include "hello1.h"
    extern "C" {
    JNIEXPORT void JNICALL Java_com_helloworld_Hello_ShowMessage
      (JNIEnv *, jobject, jstring){
    void *handle;
    const  char *error;
    void  (*init) (void);
    printf(" load Hello2 \n");
    handle = dlopen ("libHelloModule2.so", RTLD_LAZY);
    printf (" lib Hello2 onload.. \n");
    error = dlerror();
    if (!handle) {
          printf ("lib HelloModule2 not loaded correctly %s \n", error);
          exit(1);
       dlerror();
       init =(void(*)())  dlsym(handle, "hello2");
      error = dlerror();
            if(error)
                    fprintf(stderr, "Could not find print_hello(): %s\n",
    error);
                    exit(1);
    (*init)();
        dlclose(handle);
    void hello_bug()
    printf ("Hello bug correctly  invoked : CQFD\n");
    }// extern "C"
    hello2.cc
    #include "hello1.h"
    typedef void  ( *PF1) (char *, char *);
    extern "C" {
    void hello2(){
    printf ("Hello2 : ping Hello1\n");
    /*simple call work in c not via JNI*/
    hello_bug();
    Hello.java :
    package com.helloworld;
    import java.util.*;
    import java.io.*;
    public class Hello  {
      private native void ShowMessage(String msg);
      public void initialized() {
                System.out.println(" ShowMessage - called");
      try {
              ShowMessage("Generated with JNI");
           } catch (Exception e ) {
                e.printStackTrace();         }
      public Hello(){
      System.loadLibrary("HelloModule1");
                System.out.println(" HelloModule1 loaded");
    TestLocal.java :
    import java.util.*;
    import java.io.*;
    import com.helloworld.Hello;
    public class TestLocal{
    public TestLocal(){
            System.out.println("test local");
    public static void main(String[] args) {
            TestLocal test_local = new TestLocal();
            Hello test = new Hello();
            test.initialized();
    }THE MOST IMPORTANT IS IN THE MAKEFILE:
    Makefile :all: Hello.jar hello_jni.h libHelloModule1.so libHelloModule2.so TestLocal.class dummy
    Hello.jar: com/helloworld/Hello.class
    jar cvf $@  com/helloworld
    com/helloworld/Hello.class: Hello.java
    $(JAVAC)  -d . Hello.java
    hello_jni.h: Hello.jar
    $(JAVAH) -jni -o $@ -classpath ./Hello.jar com.helloworld.Hello
    libHelloModule1.so : hello_jni.h hello1.o  
    gcc  -G  -o $@ hello1.o -lstdc++
    libHelloModule2.so : hello2.o
    gcc   -G  -o $@ hello2.o -Wl -lstdc++  -L. -lHelloModule1   [u] # -->CASE  1 :THIS WORKS [/u]
    gcc   -G  -o $@ hello2.o -Wl -lstdc++ [u] #-->CASE 2 :THIS  DOES NOT WORK[/u]
    dummy : dummy_main.o
    gcc  -o $@ dummy_main.o -L. -lHelloModule1 -L/usr/local/lib -lstdc++
    hello2.o : hello2.cc
    gcc -I. -O -c  hello2.cc
    hello1.o : hello1.cc
    gcc -I. -O -c  hello1.cc
    TestLocal.class : TestLocal.java
    $(JAVAC) -classpath  . -d . TestLocal.java
    dummy_main.o :  dummy_main.cc
    gcc -I. -O -c  dummy_main.cc
    clean:
    rm -rf com *.o *.so *.class *.jar hello_jni.h dummyCASE 1 : libHelloModule1.so is explicitely linked to libHelloModule2
    myhost % dummy
    load Hello2
    lib Hello2 onload..
    Hello2 : ping Hello1
    Hello bug correctly invoked : CQFD
    myhost % java -cp . TestLocal
    test local
    HelloModule1 loaded
    ShowMessage - called
    load Hello2
    lib Hello2 onload..
    Hello2 : ping Hello1
    Hello bug correctly invoked : CQFD
    CASE 2 : libHelloModule1.so is not explicitely linked to libHelloModule2
    myhost % dummy
    load Hello2
    lib Hello2 onload..
    Hello2 : ping Hello1
    Hello bug correctly invoked : CQFD
    myhost % java -cp . TestLocal
    test local
    HelloModule1 loaded
    ShowMessage - called
    load Hello2
    lib Hello2 onload..
    lib HelloModule2 not loaded correctly ld.so.1: java: fatal: relocation error: file ./libHelloModule2.so: symbol hello_bug: referenced symbol not found
    My concern is to have this working in CASE1 with the JNI interface the same way it does in standard C built runtime.
    So does any have encountered this?
    Is there something I missed somewhere?
    Thanks lot for your help
    Youss

    Hi,
    I have implemented JNative which seems to be close to your problem.
    It works under Windows and Linux, and loads libraries via dlopen and dlsym.
    You can have a look at it's implementation at http://jnative.cvs.sourceforge.net/jnative/JNativeCpp/
    Don't forget to load your libraries before trying to call them with System.load("/path/to/your/lib.so"); if they are not referenced by LD_LIBRARY_PATH.
    This post may be false since I know nothing about Solaris. Perhaps JNative may be ported under Solaris ?
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • XmlSaveDom unresolved symbol, and special characters in output...

    I have a couple of issues with XmlSaveDom() that I'm hoping someone can help with...
    Firstly, under windows I'm having difficulty locating the library that it lives in. I'm linking to:
    oraxml10.lib (from the 10.1.0.2 XDK, the latest version I can find) and oci.lib (from the 10.2 client)...but getting an unresolved symbol on XMLSaveDom().
    I'm using the XDK because under windows I only have a client install which does not appear to have any of the XML headers or libraries in it. I'm using
    10.1.0.2 because it's the latest version I can find to download from technet.
    Secondly, under Solaris I'm just linking to libclntsh.so from 10.1.0.2 server home, and this resolves XMLSaveDom() ok. However when I use XMLSaveDom() I find unusual special characters in the output periodically:
    ÿ¾Ý <SOME_TAG>some_value</SOME_TAG>
    The strange character sequence is always the same.
    Any help with either of these would be greatly appreciated.

    The DOM is not required to escape the characters, so it is correct that you get the literal ampersand characters when you ask the DOM for a getNodeValue().
    When an XML document is serialized -- using, for example, the XMLDocument.print() method -- it is when this external form of the document is produced that escaping occurs.
    You can always call XMLNode.print() to serialize the value of a node and it's children into a PrintWriter that wraps a StringWriter to get the string equivalent of the properly escaped values.

  • Unresolved symbols while linking

    Hello all,
    I'm toying around with oo4o and I'm having a linking problem. I'm working in VS.NET 2003.
    I added the directories for headers, excutables, libraries, etc. At first I had 9 unresolved symbol errors, but I got it down to 2 by remembering to link with oraclm32.lib (debug copy). Not sure why those 2 errors are still there. My test function is basically the first sample in the Help docs, something like this:
         OStartup();
         ODatabase odb("ora9", "username", "passwd");
         ODynaset odyn(odb, "select * from emp");
         double salary;
         while (!odyn.IsEOF())
         odyn.GetFieldValue("sal", &salary);
    odyn.MoveNext();
         OShutdown();
    The relevant parts of the buildlog. Once I added the additional command line option to link with oraclm32, everything resolved except references to OStartup and OShutdown. Seems odd. Any ideas?
    Buildlog:
    Searching libraries
    Searching C:\oracle\ora92\oo4o\CPP\LIB\oraclm32.lib:
    Found "__declspec(dllimport) public: virtual __thiscall ODatabase::~ODatabase(void)" (__imp_??1ODatabase@@UAE@XZ)
    Referenced in Dataconnect.obj
    Loaded oraclm32.lib(ORACLM32.dll)
    Found "__declspec(dllimport) public: virtual __thiscall ODynaset::~ODynaset(void)" (__imp_??1ODynaset@@UAE@XZ)
    Referenced in Dataconnect.obj
    Loaded oraclm32.lib(ORACLM32.dll)
    Found "__declspec(dllimport) public: int __thiscall ODynaset::MoveNext(int)" (__imp_?MoveNext@ODynaset@@QAEHH@Z)
    Referenced in Dataconnect.obj
    Loaded oraclm32.lib(ORACLM32.dll)
    Found "__declspec(dllimport) public: int __thiscall ODynaset::GetFieldValue(char const *,double *)const " (__imp_?GetFieldValue@ODynaset@@QBEHPBDPAN@Z)
    Referenced in Dataconnect.obj
    Loaded oraclm32.lib(ORACLM32.dll)
    Found "__declspec(dllimport) public: int __thiscall ODynaset::IsEOF(void)const " (__imp_?IsEOF@ODynaset@@QBEHXZ)
    Referenced in Dataconnect.obj
    Loaded oraclm32.lib(ORACLM32.dll)
    Found "__declspec(dllimport) public: __thiscall ODynaset::ODynaset(class ODatabase const &,char const *,long,class OSnapshotID *)" (__imp_??0ODynaset@@QAE@ABVODatabase@@PBDJPAVOSnapshotID@@@Z)
    Referenced in Dataconnect.obj
    Loaded oraclm32.lib(ORACLM32.dll)
    Found "__declspec(dllimport) public: __thiscall ODatabase::ODatabase(char const *,char const *,char const *,long)" (__imp_??0ODatabase@@QAE@PBD00J@Z)
    Referenced in Dataconnect.obj
    Loaded oraclm32.lib(ORACLM32.dll)
    SNIP
    Dataconnect.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __fastcall OShutdown(void)" (__imp_?OShutdown@@YIXXZ) referenced in function "long __fastcall PostData(char *)" (?PostData@@YIJPAD@Z)
    Dataconnect.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __fastcall OStartup(int)" (__imp_?OStartup@@YIHH@Z) referenced in function "long __fastcall PostData(char *)" (?PostData@@YIJPAD@Z)

    Hi Guys,
    I got this error too recently. Was troubling me a lot. I was using Windows 7 OS, Visual Studio 2010 compiler.
    The fix for this is pretty much straight forward and solution lies in the Project settings only.
    To my knowledge, with /MDd switch, it causes the compiler to place the library name MSVCRTD.lib into the .obj file.
    But with /MTd switch, This option just causes the compiler to place the library name LIBCMTD.lib into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols. For details, please refer to this MSDN article:
    https://msdn.microsoft.com/en-us/library/2kzt1wy3(VS.71).aspx
    Its very useful.
    Also
    MDd stands for Multi-threaded Debug DLL
    MTd stands for Multi-threaded Debug
    Thanks,
    Kiran

  • Unresolved symbol: U_get_previous_frame_x in intermedia

    Hi All
    I am getting the following error while running a test command "exec ctx_output.start_log('log')"
    /usr/lib/dld.sl: Unresolved symbol: U_get_previous_frame_x (code) from /opt/ims
    /oracle/product/RDBMS/8.1.5/ctx/lib/libctxx8.sl
    /usr/lib/dld.sl: Unresolved symbol: U_get_frame_info (code) from /opt/ims/oracl
    e/product/RDBMS/8.1.5/ctx/lib/libctxx8.sl
    BEGIN ctx_output.start_log('log'); END;
    ERROR at line 1:
    ORA-20000: ConText error:
    ORA-06520: PL/SQL: Error loading external library
    ORA-06522: Unresolved external
    ORA-06512: at "CTXSYS.DRUE", line 122
    ORA-06512: at "CTXSYS.CTX_OUTPUT", line 39
    ORA-06512: at line 1.
    Can some body help me on this please.....
    This is very urgent.
    Regards
    UDay
    null

    Hi Tofubug,
    Since I'm not familiar about C#, however, if want to run powershell script in C#, the script below may be helpful for you:
    RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
    Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration);
    runspace.Open();
    RunspaceInvoke scriptInvoker = new RunspaceInvoke(runspace);
    Pipeline pipeline = runspace.CreatePipeline();
    //Here's how you add a new script with arguments
    Command myCommand = new Command(scriptfile);
    CommandParameter testParam = new CommandParameter("key","value");
    myCommand.Parameters.Add(testParam);
    pipeline.Commands.Add(myCommand);
    // Execute PowerShell script
    results = pipeline.Invoke();
    And these threads for your reference:
    Execute PowerShell Script from C# with Commandline Arguments
    How to run PowerShell scripts from C#
    How do you set FullLanguage mode
    for remote PowerShell from C#?
    If I have any misunderstanding, please feel free to let me know.
    Best Regards,
    Anna Wang

  • Unresolved symbol : OCIEnvCreate (code)  from libocci.sl.10.1

    I'm getting a core dump, with the error message "Unresolved symbol : OCIEnvCreate (code) from libocci.sl.10.1", when I try to execute a simple OCCI code that connects to the database and performs some SQL queries. It is occuring at the following line :
    Environment *env = Environment::createEnvironment(Environment::DEFAULT);
    I'm using oracle 9i (Ver 9.2.0.6.0) on HP-UX (Ver 11),
    I'm using Oracle Instant Client for HP-UX PA-RISC (32-bit) (Version 10.2.0.2) libraries for OCCI.
    Can anyone help me out?

    I'm using aCC compiler, and doing dynamic linking..I've specified the directory path of the .sl files of the instant client in SHLIB_PATH, do I need to specify the path in ORACLE_HOME, or some other env variable??
    Can you tell me steps that I should follow while compiling, linking & execute the code?

  • Unresolved symbol after migrating Pro*C from Oracle 8i to Oracle 10gR2

    Hello,
    We are currently migrating a 32bits application written in Pro*C and Pro*Cobol from Oracle 8i client to Oracle 10gR2 client (Oracle 10gR2 server).
    Precompiling, compiling and linking the source files are ok. But at runtime, the following error appears :
    /usr/lib/dld.sl: Unresolved symbol: __sendpath64 (code) from /logiciel/oracle/client_10203/lib32/libclntsh.sl.10.1
    Here is the command used for pre-compiling, compiling and linking :
    +----> Precompiling Pro*C src/its_execute_lmd.pc ...
    proc maxopencursors=100 hold_cursor=yes release_cursor=yes ireclen=500 oreclen=132 mode=ORACLE code=ANSI_C dbms=v8 unsafe_null=yes ltype=none include=(inc,/logiciel/oracle/client_10203/network/public,/logiciel/oracle/client_10203/plsql/public,/logiciel/oracle/client_10203/precomp/public,/vtcvd10/vcour/common/alimentation_com/afonction_partagee/inc,/logiciel/oracle/client_10203/rdbms/public,/logiciel/oracle/client_10203/rdbms/demo,) iname=src/its_execute_lmd.pc
    Pro*C/C++: Release 10.2.0.3.0 - Production on Mer. Déc. 5 10:16:56 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Valeurs des options système par défaut extraites de : /logiciel/oracle/client_10203/precomp/admin/pcscfg.cfg
    +----> .................... src/its_execute_lmd.c OK
    +----> Compiling src/its_execute_lmd.c ...
    cc -Ae -Iinc -I/logiciel/oracle/client_10203/network/public -I/logiciel/oracle/client_10203/plsql/public -I/logiciel/oracle/client_10203/precomp/public -I/logiciel/oracle/client_10203/rdbms/public -I/logiciel/oracle/client_10203/rdbms/demo -I/vtcvd10/vcour/common/alimentation_com/afonction_partagee/inc -c src/its_execute_lmd.c -o src/its_execute_lmd.o
    +----> .................... src/its_execute_lmd.o OK
    +----> Building its_execute_lmd ...
    cc -Wl,+s -Wl,+n -Llib -L/vtcvd10/vcour/lib -L/logiciel/oracle/client_10203/lib32 -L/logiciel/oracle/client_10203/rdbms/lib32 -o bin/its_execute_lmd src/its_execute_lmd.o -l:libclntsh.sl -l:libits.a
    +----> .................... its_execute_lmd OK
    Here is the SHLIB_PATH var used at runtime :
    SHLIB_PATH=/logiciel/oracle/client_10203/lib32
    I would appreciate any help about this unresolved symbol in the Oracle shared library.
    Thank you in advance.

    What does the program do? It might make more sense, given the tremendous number of changes and enhancements to just rewrite it.

  • Clueless about this "unresolved symbols"

    Hi there!
    I made a portation from Win32 to SunSolaris8 and I finally succeeded compiling my .so. There are no syntactical errors or binding errors when compiling with CC (SunStudio 8).
    But while executing the application which uses my .so I get the error log:
    code:
    The reason /ya/yao55/yao55c5/wisdev/src/ug-ifc/mach/resource/library/tool/tdm/ugs.so failed to load was:
    There are unresolved symbols in the image:
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6Mrk1IIrkn0C__v_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___M__sun_append6Mrk1_r1_
         __1cH__rwstdRexcept_msg_string2t6MIE_v_
         __1cDstdLlogic_error2T5B6M_v_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Efind6kMpkcII_I_
         __1cDstdMout_of_rangeG__vtbl_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mrk1_r1_
         __1cDstdMout_of_range2T6M_v_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___M__sun_concat6kMpkc_1_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___M__sun_append6Mpkc_r1_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___J__nullref_
         __1cH__rwstdbC__rwse_StringIndexOutOfRange_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6Mpkcrkn0C__v_
         __1cDstdLlogic_errorG__vtbl_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Gassign6Mrk1II_r1_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mpkc_r1_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hcompare6kMIIpkcI_i_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___M__sun_concat6kMrk1_1_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_
         __1cDstdbC__RTTI__1nDstdMout_of_range__
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___H__clone6M_v_
         __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___I__getRep6MII_pnH__rwstdM__string_re f4Ccn0B_n0C____
    Anyone any idea?
    Do I have to link to some lib of c/c++?
    Thx so far, Micha

    First, you should be linking your shared object (ugs.so) with the flag "-z defs", and probably with "-z defs -z text". By doing this, you will force the errors that you are now getting at runtime to be exposed at build time.
    Second, it looks as if your library is missing the standard C++ library. I don't know what the flags are for Studio 8, but for Forte 6U2 passing -library=Crun,Cstd on the compile and link lines sets things up correctly.

  • FORTE 30M+HP11 - Unresolved symbol __shlinit ?

    Hi,
    Doing a C library using 3.0.G.2 & HP 10.20 enables me
    to link 'helloworld.c' with it and run the resulting a.out.
    Doing the same on 3.0.M & HP 11 enables me to link as
    well, but running a.out I got the following message:
    /usr/lib/dld.sl: Unresolved symbol: __shlinit (code) from
    /opt/forte/bldvsn3/install/lib/libqqxh.sl
    Abort(coredump)
    I tried to get the link command called by fcompile, and change
    the order of libraries but that didn't change the errror message
    What to do ?
    Thanks
    j-paul gabrielli

  • Dwp dumps core. Unresolved symbol: timezone_getDefaultTZID

    Hi,
    Subscribing to another user calendar or resources generates the following messages to the console and dwp dumps core.
    /opt/SUNWcal/calendar/bin> /usr/lib/dld.sl: Unresolved symbol: timezone_getDefaultTZID (code) from ./libcore_parser10.sl
    /usr/lib/dld.sl: Unresolved symbol: timezone_getDefaultTZID (code) from ./libcore_parser10.sl
    /usr/lib/dld.sl: Unresolved symbol: timezone_getDefaultTZID (code) from ./libcore_parser10.sl
    /usr/lib/dld.sl: Unresolved symbol: timezone_getDefaultTZID (code) from ./libcore_parser10.sl
    Platform: HPUX11.11
    Calendar: 2005Q4
    Thanks,
    Toriq

    <pre>
    Hi Donald,
    You should have logged this as new problem under new thread.
    I would suggest to try search for "106327" at
    http://access1.sun.com
    P.S: Use bottom search engine.
    Thanks
    Kalpesh

  • Unresolved symbol with parseInt

    Hi all!
    I'm a newbie in Java and wondering if anyone can help me out
    I've been using the following code:
    int j = new Integer.parseInt(i);
    where i contains a string that is always a number like 18 or 67
    when I run my code I get the unresolved symbol error with the parseInt method. But isn't the java.lang.* already imported? How come I can't use this method? Actually I'm learning my java through JSP so my code is actually in a .jsp page. Does anyone have any idea why I can't use the parseInt method?

    sigh
    what type of Object does 'session.getAttribute("Type")' return?
    if its a String, and is properly formatted, Integer.parseInt((String)session.getAttribute("Type")) will work. (don't 4get about the NumberFormatException)
    if its an Integer object, ((Integer)session.getAttribute("Type")).intValue(); will work.
    rob,
    Thanks I haven't tried that yet but it's similar to
    what I did. This one works:
    int j =
    Integer.parseInt((String)session.getAttribute("Type"));
    I was wondering if I can skip the conversion to string
    and got straight and convert to an integer. Is that
    possible?
    Thanks!

  • Missing prototype and Undefined Symbol errors

    So, I am using an Opal Keyy XEM3005 board.
    Depending on the documentation I read, this board has a native ANSI C interface with a C++ wrapper.
    In their forums, they say to rename the ".cpp" file to "c", and then go forward with calling the default constructor & keep track of the pointer.  Their functions are all in an externally loadable DLL.
    Well and good.
    Their API documentatin is available here:  http://www.opalkelly.com/library/FrontPanelAPI/
    I have written a REALLY simple app to ease my way in - it does nothing more than allow the user to throw a switch, and when this happens, it goes off to connect to the board:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #include <cvirte.h>
    #include <userint.h>
    #include "Try1.h"
    #include "XEM.h"
    #define _WIN32_WINNT 0x0501
    //#define _WIN32
    #include <windows.h>
    static int panelHandle;
    static okFrontPanel_HANDLE    XEM_Device;
    int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpszCmdLine, int nCmdShow)
    if (InitCVIRTE (hInstance, 0, 0) == 0)
    return -1;    /* out of memory */
    if ((panelHandle = LoadPanel (0, "Try1.uir", PANEL)) < 0)
            return -1;
        DisplayPanel (panelHandle);
        RunUserInterface ();
        DiscardPanel (panelHandle);
        return 0;
    int CVICALLBACK Connect (int panel, int control, int event,
            void *callbackData, int eventData1, int eventData2)
        int    Value = 0;
        switch (event)
            case EVENT_COMMIT:
                GetCtrlVal(PANEL, PANEL_CONNECT_SWITCH, &Value);
                SetCtrlVal(PANEL, PANEL_CONNECT_LED, Value);
                if( Value )
                    XEM_Connect(XEM_Device);
                else
                    XEM_Disconnect(XEM_Device);
                break;
        return 0;
    int CVICALLBACK Quit (int panel, int control, int event,
            void *callbackData, int eventData1, int eventData2)
        switch (event)
            case EVENT_COMMIT:
                QuitUserInterface (0);
                break;
        return 0;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This, of course, works fine by itself (with empty _Connect() and _Disconnect() functions)
    I then started working with the XEM_Connect function.
    The first step is to run their LoadDLL function as such:
    int XEM_Connect ( okFrontPanel_HANDLE    XEM_Device )
        int    NoDevices = 0;    //    Number of devices attached to the PC
        //    Load the DLL (?)
        // Load the FrontPanel DLL
        if (FALSE == okFrontPanelDLL_LoadLib(NULL))
            printf("Could not load FrontPanel DLL\n");
            exit(-1);
        return XEM_SUCCESS;
    And this would compile and run just fine.
    Now, when I added the functions to start trying to get info about the device, I started getting "missing prototype" errors.
    int XEM_Connect ( okFrontPanel_HANDLE    XEM_Device )
        int    NoDevices = 0;    //    Number of devices attached to the PC
        //    Load the DLL (?)
        // Load the FrontPanel DLL
        if (FALSE == okFrontPanelDLL_LoadLib(NULL))
            printf("Could not load FrontPanel DLL\n");
            exit(-1);
        //    Find out how many devices are attached
        XEM_Device = okFrontPanel_Construct(  );
    //    XEM_Device = okCFrontPanel( void );
    //    NoDevices = GetDeviceCount( );
        printf("%d OK devices attached\n", NoDevices);
        //    Call the contructor?    
    //    okCFrontPanel ();
        return XEM_SUCCESS;
    Now, I searched the forums and found the bits about adding #define _WIN32_WINNT 0x0501 prior to inclusion of windows.h.  Did that.  No joy.
    Then I searched some more and found the bit about changing the build options to uncheck the "prototype required" flag.
    Done.
    This seemed to work at first (the above code could be built with no errors, and appeared to run).
    So I thought maybe I had it, and added the next line, so:
    int XEM_Connect ( okFrontPanel_HANDLE    XEM_Device )
        int    NoDevices = 0;    //    Number of devices attached to the PC
        //    Load the DLL (?)
        // Load the FrontPanel DLL
        if (FALSE == okFrontPanelDLL_LoadLib(NULL))
            printf("Could not load FrontPanel DLL\n");
            exit(-1);
        //    Find out how many devices are attached
        XEM_Device = okFrontPanel_Construct(  );
        OpenBySerial( XEM_Device, "UaLgzvVpBJ" );
    //    XEM_Device = okCFrontPanel( void );
    //    NoDevices = GetDeviceCount( );
        printf("%d OK devices attached\n", NoDevices);
        //    Call the contructor?    
    //    okCFrontPanel ();
        return XEM_SUCCESS;
    Now it doesn't complain about no prototypes (duh), but instead I get linker errors:
        Undefined symbol '_OpenBySerial@0' referenced in "XEM.c".
    So, dredging through the .h and .c files, I found a couple of things:
    in the okFrontPanel.c file I found the following:
    okDLLEXPORT ok_ErrorCode DLL_ENTRY
    okFrontPanel_OpenBySerial(okFrontPanel_HANDLE hnd, const char *serial)
        if (_okFrontPanel_OpenBySerial)
    ;  return((*_okFrontPanel_OpenBySerial)(hnd, serial));
        return(ok_UnsupportedFeature);
    In the okFrontPanel.h file I found:
    and also:
    okDLLEXPORT ok_ErrorCode DLL_ENTRY okFrontPanel_OpenBySerial(okFrontPanel_HANDLE hnd, const char *serial);
    So, I see them in the .h & .c files, but the linker is bombing out.
    I smell a problem with actual code to link being in the DLL...  How do I resolve this, any ideas?  Or am I doing something so stupidly (and obviously) wrong that I'm being blinded to it?

    Hi tomii,
    My suspicion is that these issues are due to using a C++ dll in a C environment. There are inherent challenges with performing such an operation as you have to make sure all your parameters and settings are correct.
    I also could not find the documentation that the Opal Kelly dll is ANSI C but it sounds like you can use this in C with some reconfiguration. I would recommend using their forums to get more information on what steps need to take place to get things working in ANSI C.
    From the information you provided, I did find some resources on the missing prototype error and undefined symbol issue with the linker.
    For the missing prototype I found a thread of someone actually using LabWindows and seeing this compiler error you may want to look at
    http://bytes.com/topic/c/answers/695019-missing-prototype
    I found a few cases where using a function definition of int func(void) removes such issue when int func() does not.
    Another link I found that may be worth a look can be found at http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html
    It gives some good pointers to mixing C and C++ code. Some of it may be applicible in your case.
    And, a resource for your undefined symbol linking issue.
    http://www.cprogramming.com/tutorial/compiler_linker_errors.html
    Hopefully these resources will give some context for getting things compiling and working with your dll.
    Good luck!
    James W.
    Applications Engineer
    National Instruments

  • My kid just got an iPod 5th gen (today from Santa) and it won't power up or charge. The only response is when I connect the USB and press the power button or front button the Battery appears with red line and lightning symbol. No other response at all.

    Sorry about the long title.....its my first post.
    My kid just got a brand new iPod 5th generation (today from Santa) and it won't power up or charge. The only response is when I connect the USB and press the power button or front button the Battery appears with red line on left and lightning symbol below. There is no other response at all no matter what I do, including holding both buttons down for extended period.  My other kid got one and it works perfectly.....I have interchanged usb cables ports etc. but still no response....I would really appreciate any help.  

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    -  Make an appointment at the Genius Bar of an Apple store since you have a hardware problem with the iPod. This is because as you said the same cable works with another iPod.
    Apple Retail Store - Genius Bar

  • After updating my Iphone 4s to os 7.1.1 ota, my phone went into recovery mode. Yet when I try to restore it with Itunes on my windows 7 laptop it says the network connection has been reset! My phone has the itunes logo and charger symbol on it .

    After updating my Iphone 4s to os 7.1.1 from 7.1 over the air, my phone went into recovery mode. Yet when I try to restore it with Itunes on my windows 7 laptop it says the network connection has been reset. Make sure your network settings are correct and your network is active, or try again later. My phone has the itunes logo and charger symbol on it, as well as an arrow pointing at the Itunes logo. After holding the sleep button down or even doing the hard reset the same screen comes up on my phone regardless of whether it is plugged in or not to my computer. I have turned my computer off and on again. It is plugged in and charging as it's battery life is very short. I also reset my modem and the same error message pops up. The only option on my computer when my phone is plugged in is to restore it. My firewall also allows Itunes through it. I have literally tried everything I know being someone who knows very little about technology. I also do not want to hear about how the update worked for other people. My phone has been in recovery mode for 5 hours at least now so it will just make me more frustrated if a bunch of people post about how the update worked for them.

    Once the Device is asking to be Restored with iTunes... it is too late to save anything... and you must continue with the Recovery...
    kevinpowell1 wrote:
    how can i get it out of recovery mode?
    Make sure you have the Current Version of iTunes Installed on your computer
    iTunes free download from www.itunes.com/download
    Then See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps...
    Take your time... Pay particular attention to Steps 3 and 4.
    Some users have reported as many as 8 or 9 attempts were necessary before success.
    After you have Recovered your Device...
    Re-Sync your Content or Restore from the most recent Backup...
    Restore from Backup  >  http://support.apple.com/kb/ht1766
    If the issue persists...
    Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
    Be sure to make an appointment first...

  • I have just purchased an iphone today and it is coming up with a picture on the screen of the usb connector and itunes symbol. It also says that I now have no service and can only make emergency calls

    I have just purchased an iphone today and it is coming up with a picture on the screen of the usb connector and itunes symbol. It also says that I now have no service and can only make emergency calls

    Just a thought, but maybe consider returning the device.  Seems it might be a bit too complicated for you.

Maybe you are looking for

  • App wont open!!

    I recently received my iphone 6 and everything was running smoothly until i ran in to this problem. when i open imovie it is gray for a split second then it closes. I tried restarting my phone and i still have the same problem. then i find that pages

  • Automatic SOS in shopping cart for reservation items

    Dear all, I am creating a shopping cart using a catalog item that creates a reservation in the backend (classic). However, when i change sthing, the system reads an info record that exist in the back-end and assigns the vendor as the source of supply

  • Tran log backup fail after setting a DB offline

    This is strange.  SQL 2005 SP3 (build 4340).  Full backup job and tran log backup job are separate maint plans/Agent jobs as opposed to multiple steps in one maint plan (don't ask me... I didn't set it up that way.) I set a database XYZ offline last

  • Thank adobe team for Cp 8.0.1

    Thank adobe team for Cp 8.0.1 many thing get better. and i wish to see 8.0.2 thank you

  • Local storage with Content viewer

    I have a problem with local storage since last update of the content viewer. We create a folio with exclusive HTML5 files using some data that have to be saved on the iPad (User ID). It works very well during one month but since the last update, we h