Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this after using the information WhirlWind gave you (the lines beginning with '#' are comments; you don't need to type them):</p> <pre><code># Ensure that any shared objects you use are available in the current directory. export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH # Compile the library with a real name of "libctest.so.1.0.1" # and a soname of "libctest.so.1". gcc -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0.1 ctest1.o ctest2.o # Create a symbolic link with soname as the name that points to the library. # (libctest.so.1 -&gt; libctest.so.1.0.1) /sbin/ldconfig -v -n . # Create a symbolic link using the "linker name" that points to the newly # created library. ln -sf libctest.so.1 libctest.so # Compile your program. gcc -Wall -L. prog.c -o prog -l ctest # Run your program (it won't work without setting LD_LIBRARY_PATH because # it won't be able to find your library). ./prog </code></pre> <p>That worked for me. It's a lot of work seemingly, but after a few trial-and-error cases, I think it becomes almost routine.</p> <p>You can find some more information at <a href="http://www.ibm.com/developerworks/library/l-shobj/" rel="nofollow noreferrer">http://www.ibm.com/developerworks/library/l-shobj/</a>. :)</p> <p>Edit: I almost forgot to mention that it seems a lot of tutorials suggest using the -fPIC option to generate position-independent code (don't confuse it with -fpic since that can make your resulting library less portable). It couldn't hurt to have it, but for simplicity I omitted it from the lines above.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload