I don't have VS 2008 and thus cannot experiment with it.
On Mon, Jun 1, 2009 at 9:53 AM, Sean <sean...@gmail.com> wrote:
> 1>c:\projects\cpp_unit_tests\mockexamples\automatedtellingmachinetest
> \..\AutomatedTellingMachine\MockBankAccount.h(25) : warning C4251:
> 'MockBankAccount::gmock_VerifyCustomerPin_25' : class
> 'testing::internal::FunctionMocker<Function>' needs to have dll-
> interface to be used by clients of class 'MockBankAccount'
Not sure if this warning is essential, but it suggests that you may
need to export Google Mock's FunctionMocker class template (and
possibly other classes it depends on) as well. Could you try to add
MY_API to these class definitions?
> 1> with
> 1> [
> 1> Function=bool (long)
> 1> ]
> 1>Linking...
> 1>SimpleTests.obj : error LNK2028: unresolved token (0A0001B5)
> "public: virtual __thiscall MockBankAccount::~MockBankAccount
My guess is that VC cannot generate the destructor of MockBankAccount
because it needs to call the destructor of FunctionMocker, which is
not exported. Therefore fixing the above warning may fix this error
as well. The same for the errors below.
If this doesn't work or turns out too much work, here's another idea:
Instead of exporting your mock class definition from an unmanaged DLL,
could you write your test functions in the same DLL (and in unmanaged
C++) and then export the test functions? Your top-level tests can
still be written in managed C++ - they will simply call the real test
functions in the DLL.
--
Zhanyong