Created
February 6, 2017 09:59
-
-
Save gocha/0d8af8201affd28b5567e4ca068ba290 to your computer and use it in GitHub Desktop.
Fake Function Framework: Trick for replacing system functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "fff.h" | |
#include <stdarg.h> | |
//#ifdef FFF_GENERATE_FAKE_DEFINES | |
//#define FFF_EXTERN extern __declspec(dllexport) | |
//#else | |
//#define FFF_EXTERN extern __declspec(dllimport) | |
//#endif | |
#define DECLARE_FAKE_VALUE_FUNC_PROXY1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \ | |
FFF_EXTERN RETURN_TYPE FUNCNAME##_proxy(ARG0_TYPE arg0);\ | |
DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME##_proxy, ARG0_TYPE) | |
#define DEFINE_FAKE_VALUE_FUNC_PROXY1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \ | |
DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME##_proxy, ARG0_TYPE) | |
DECLARE_FAKE_VALUE_FUNC_PROXY1(int, puts, const char *); | |
// proxy.fff.c | |
//DEFINE_FFF_GLOBALS; | |
//DEFINE_FAKE_VALUE_FUNC_PROXY1(int, puts, const char *); | |
// main.c | |
// #define puts puts_proxy | |
// #include "testee/main.c" | |
// #undef puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment