FAQ #13: Creating DCMTK libraries as shared objects (.so-files)

Frequently Asked Questions regarding DCMTK

Moderator: FAQ Team

Post Reply
Message
Author
Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1435
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

FAQ #13: Creating DCMTK libraries as shared objects (.so-files)

#1 Post by Marco Eichelberg »

:?: How can I create the DCMTK libraries as shared objects (.so-files) which are dynamically loaded when the DCMTK applications are started?

:!: This depends on your C++ compiler and operating system. When building shared objects containing C++ code, special handling for templates and constructors/destructors of global variables is required. Therefore, on most systems the shared object must be created with the C++ compiler, not with "ld". If you are using gcc on a platform where the "-shared" flag is supported, the following steps will create a "dynamic" DCMTK:
  1. run rootconf and configure (see the INSTALL file).
  2. edit the file 'config/Makefile.def' to include the following settings:

    Code: Select all

    CFLAGS= -fPIC -O2
    CXXFLAGS= -fPIC -O2
    AR= gcc
    ARFLAGS= -shared -o
    LIBEXT= so
    RANLIB= :
  3. build and install the toolkit with "make", "make install" and "make install-lib".
  4. make sure that the environment variable LD_LIBRARY_PATH contains the directory where the DCMTK shared objects are installed.
Note: For Mac OS X, "-shared" should be replaced by "-dynamiclib" in step 2.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest