[Insight-users] creating ITK dll with MS Visual C++ 6.0

Martin Urschler martin at urschler.info
Mon May 1 05:01:35 EDT 2006


hi haris,

Why aren't you using cmake to compile your dll?
It's a lot simpler since all you have to do for your project is 
something like this:

CMakeLists.txt

PROJECT(MyDllUsingItk)

# Find ITK.
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
   INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
   MESSAGE(FATAL_ERROR
           "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)


ADD_LIBRARY(MyDllUsingItk SHARED sourceCode.cpp ...)


this cmake file will produce the nmake makefile for visual c++ via 
CMakeSetup.exe



furthermore I can't see where you specify the export declarations for 
your method that you want to put into a dll...
you will need something like this:

#ifdef MY_DLL_EXPORTS
    #define MY_DLL_EXT __declspec(dllexport)
#else
    #define MY_DLL_EXT __declspec(dllimport)
#endif


void MY_DLL_EXT myMethodSolvingAnyProblem()
{
...
}

class MY_DLL_EXT MyClassDoingSomethingReallyCool
{
...
}



if you have declared these things but didn't put it into the code 
snippet ... then my apologies ...
but if these things don't tell you anything you should look into your 
favourite Visual C++ book to learn more about how to write a dll

regards,
Martin


More information about the Insight-users mailing list