[Insight-users] problem building .dll

Mathieu Malaterre Mathieu . Malaterre at creatis . insa-lyon . fr
Thu, 30 Oct 2003 13:35:09 +0100


soumend at magnum . barc . ernet . in wrote:
> Hi All,
>  
> I have tried to make a shared library (.dll) from a group of cxx file. For that 
> I have used following cmakelist....
>  
> PROJECT(newclass)
> ....
> ADD_LIBRARY(newclass SHARED 
> DICOMImageSeriesFilesTOImageData.cxx
> ietkDICOMSeriesIO.cxx
> DICOMApphelper1.cxx
> )
>  
> TARGET_LINK_LIBRARIES(newclass
> vtkGraphics 
> vtkRendering 
> vtkImaging 
> vtkFiltering 
> vtkCommon 
> vtkIO
> vtkftgl
> vtkzlib 
> vtkHybrid
> ITKBasicFilters
> itksys
> ITKCommon 
> ITKIO 
> itkzlib
> ITKNumerics
> ITKAlgorithms
> )
>  
> but it is creating only newclass.dll.so whenever i am trying to use this new 
> library there arises a linking error that newclass.lib is not found. I presume 
> it is problem with cmake only but cant figure out the problem. will anyone help 
> me out.
> thanx.
> soumen

Are you using VC++ ? Is so use 'depends' to open the file newclass.dll ( 
rigth click + 'open' should works). And looks for symbols, if there 
aren't any, it will mean you forgot to export functions you want:

For instance you should do:

	__declspec( dllexport ) float myfunction( ... )

Then with 'depends' again, you should be able to see this symbol being 
export in the dll and a lib file being created.

HTH
mathieu
Ps: CMake is particularly well designed for this purpose as it 
automatically export symbol for such task, all you have to do is copy 
paste from:

	Code/Common/itkWin32Header.h

where 'ITKCommon_EXPORTS' is made of 'the_directory_name'_EXPORT