Hi,
Thank you so much for the hints. Its now working with some minor project
modifications.
First of all I created a mfc dll appwizard project to get all defines and
linker options right.
Next thing was to include the following lines into the main DLL source file
(generated by the wizard)
#include <cppunit/plugin/TestPlugIn.h>
CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CppUnit::TestPlugInDefaultImpl );
Note that the plugin macro has to be included after the stdafx.h include but
before the THIS_FILE define stuff!
Add the usual CPPUNIT_DLL define to the project defines and link with the
cppunitd_dll.lib/cppunit_dll.lib libraries.
Works perfectly with the TestPlugInRunner. (So far since I haven't tested it
that extensibly yet
In order to get it to work with the DllPlugInTester I had to build a special
target with Use MFC in a Shared DLL. I suggest that such a target get added
to the DllPluginTester.dsp project.
/Magnus
>Hi,
>
> Having trouble compiling my DllPlugin when using mfc. The compiler
> complains
> about DllMain already beeing defined.
That's because the 'default' macro implement DllMain. Use the following
macro instead:
CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CppUnit::TestPlugInDefaultImpl );
This will exports the needed function, but will not implement DllMain.
> My testcase works like a charm without mfc.
> Changing the project settings to "Use MFC in a Shared Dll" and
>including
> in my testcase source file makes the compiler barf at me!
You may want to start your project using the Wizard. I'm not sure what
the spefic are, but you probably need to define some symbols to
indicate that
your project use MFC DLL and is a DLL (MFC TestRunner generate a MFC
DLL that use CppUnit DLL, so this is not a CppUnit issue).
Notes that to run the DLL, you will need to use the MFC plug-in test
runner since DllPlugInTester is not an MFC application (though the
change should be very easy to do, just start with a MFC console app)
Please, keep us posted on your progress (I haven't try doing that, and
I'm curious about the result)
Baptiste.
---
Baptiste Lepilleur
http://gaiacrtn.free.fr/
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
|