regarding .so files and dynamic linking

Discussion in 'C++' started by pratap, Feb 28, 2007.

  1. pratap

    pratap Guest

    Is there any way in which one can link implementation by
    Vendor A in a dynamic library) and implementation by Vendor
    A in a dynamic library) and use it in 1.cpp
    where 1.cpp
    would contain
    int main()
    A a,Bb
    return 0;

    The idea here is to instantiate class object a from class A which is
    defined in and class object b from class B which is defined in
    pratap, Feb 28, 2007
    1. Advertisements

  2. This is off-topic here since it's vendor-dependent, but usually you
    have to include some files, like a.h and b.h, so 1.cpp would look
    something like:

    #include "a.h" // or perhaps <a.h>
    #include "b.h"

    int main()
    A a;
    B b;

    The rest is then up to the linker.
    =?iso-8859-1?q?Erik_Wikstr=F6m?=, Feb 28, 2007
    1. Advertisements

  3. pratap

    pratap Guest

    Does not work
    Have tried that
    pratap, Feb 28, 2007
  4. pratap

    Lionel B Guest

    ^ ^ ^ ^ ^
    Don't quote signatures.
    What happens? Doesn't compile? doesn't link? compiles and links but
    doesn't run correctly? Makes computer explode?
    Tried what??? What did you do to compile/link/run?

    How can we help you if you don't give us any information?

    Lionel B, Feb 28, 2007
  5. pratap

    pratap Guest



    gcc -rdynamic -o 1 1.cpp -L/path of so files/ -la -lb
    where -la and -lb are and
    and it worked.
    was using the wrong flags while making.
    pratap, Mar 2, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.