How load a libray?

How load a libray?

Post by luck » Sun, 14 Feb 1999 04:00:00



I know I can load a dll (dynamic linkage library) and run the dll code
under Windows. Is there a way to load a library into the current process
and run the code of the library within the same process?

Thanks for your help.

 
 
 

How load a libray?

Post by Aaron Cra » Sun, 14 Feb 1999 04:00:00




> I know I can load a dll (dynamic linkage library) and run the dll code
> under Windows. Is there a way to load a library into the current process
> and run the code of the library within the same process?

man dlopen dlsym.  By the way, on Unix, you only need to do this if you
don't know the name of the library until run time.  If you know the library
name at compile time, just link against it and it will get loaded correctly
before you enter main().

--


 
 
 

How load a libray?

Post by Juergen Hein » Sun, 14 Feb 1999 04:00:00



>I know I can load a dll (dynamic linkage library) and run the dll code
>under Windows. Is there a way to load a library into the current process
>and run the code of the library within the same process?

You might ask in a Windows specific news group, since the ways how
to do it are totally system specific. If you mean though whether it is
possible to build a library under Unix and then use that one, no, it
is not going to work.

Cheers,
Juergen

--
\ Real name     : Jrgen Heinzl                 \       no flames      /

  \ Phone Private : +44 181-332 0750              \                  /

 
 
 

How load a libray?

Post by Kurtis D. Rade » Sun, 14 Feb 1999 04:00:00




> >I know I can load a dll (dynamic linkage library) and run the dll code
> >under Windows. Is there a way to load a library into the current process
> >and run the code of the library within the same process?

> You might ask in a Windows specific news group, since the ways how
> to do it are totally system specific. If you mean though whether it is
> possible to build a library under Unix and then use that one, no, it
> is not going to work.

If the original question is whether it is possible to dynamically (that
is, at run time) bind to functions in a library in a fashion analogous
to how DLLs are utilized in MS Windows/NT, the answer is yes.  Start by
creating a shared library (on many UNIXes the ld(1) command has a -G
switch for this purpose).  The actual routines used to perform the
linkage at run time is dependent on which UNIX you are running.  For
example, you might have a dlopen(3x) function on your platform.

--

Sequent Computer Systems                     voice: +1 503-578-3714
15450 SW Koll Pkwy, MS RHE2-501              http://www.sequent.com
Beaverton, OR 97006-6063

 
 
 

How load a libray?

Post by Aaron Cra » Tue, 16 Feb 1999 04:00:00






> I have a library which exports some function names. It loads a supplied
> library which exports the same function names and tries to load them to call
> using different names. The problem is the dlopen is failing with the
> following error:

> 0509-025 The libmqm.a file is not executable or not in correct XCOFF
> format.

> libmqm.a is a supplied library that I cannot change. How do I find out what
> format it's in and then how do I load it?

You can find out its format with `file libmqm.a' -- but I can tell you that
it's a static library.  (Any library called *.a is a static library.)  This
means that you can only link against libmqm.a at compile time.

What exactly are you trying to achieve?  Why does your library have the same
symbols as libmqm.a?

--