MrazqRuby / googlemock

Automatically exported from code.google.com/p/googlemock
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

How to mock C-Style Win32 API methods? #99

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I'm not sure how to mock C-style API calls.
E.g. I've a myprogram_api.h code snippet as below.
...

typedef enum _MYPROGRAMRET {
    SUCCESS,
    ...,
    ...
} MYPROGRAMRET;

MYPROGRAMAPI_CALL(MYPROGRAMRET) MYPROGRAMAPI_isEnabledA(IN char* userName);
MYPROGRAMAPI_CALL(MYPROGRAMRET) MYPROGRAMAPI_isEnabledW(IN LPWSTR userName);

#ifdef _UNICODE
#define MYPROGRAMAPI_isEnabled MYPROGRAMAPI_isEnabledW
#else
#define MYPROGRAMAPI_isEnabled MYPROGRAMAPI_isEnabledA
#endif // !UNICODE
...

What version of the product are you using? On what operating system?
gmock-1.0.0, Windows XP, Visual Studio 2005 (msvc8).

Please provide any additional information below.
The external myprogram_api.h project will output a DLL. Is Gmock the way to
unit test without the myprogram_api.h project's DLL? 

Original issue reported on code.google.com by shee...@gmail.com on 2 Feb 2010 at 4:29

GoogleCodeExporter commented 9 years ago
Hi seeeng,

Would you please post your question to the googlemock@googlegroups.com 
discussion
group?  The issue tracker is for reporting bugs and feature requests.  Thanks.

Original comment by w...@google.com on 2 Feb 2010 at 5:34