Slicer3:Windows Shared Libraries

From NAMIC Wiki
Revision as of 03:09, 8 August 2007 by Pieper (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home < Slicer3:Windows Shared Libraries

How to Add a New Windows Shared Library

For these examples we will assume you want to make a directory MyLib -- substitute your only lib name in the instructions below.

Copy the following files from an existing library (say SampleLib) to create:

vtkMyLib.h

Change the #include to use MyLib

This header can be use for other lib-specific defines.

vtkMyLibWin32Header.h

(careful - this file is error prone!)

Change all SampleLib to be MyLib. Change all VTK_SAMPLELIB_EXPORT to be VTK_MYLIB_EXPORT. Change VTKSampleLib_STATIC to be VTKMyLib_STATIC Change sampleLib_EXPORTS to be myLib_EXPORTS (NOTE: this is the name of the lib, which may not be the name of the project).

vtkMyLibConfigure.h.in

Change VTKSampleLib_STATIC to VTKMyLib_STATIC

CMakeLists.txt

In the CMakeLists.txt edit the CONFIGURE_FILE to put MyLib in the binary directory for your project.

Header Files

Include vtkMyLib.h

Add VTK_MYLIB_EXPORT after the keyword 'class' and before your classname.

class VTK_MYLIB_EXPORT vtkMyObject : public vtkObject