Skip to content

Commit d842db7

Browse files
Allow new and delete to be replaced (#44)
1 parent dccc577 commit d842db7

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ if(USE_CPPRESTSDK)
2222
string(APPEND EXTRA_FLAGS " -DUSE_CPPRESTSDK")
2323
endif()
2424

25+
if(INJECT_HEADER_AFTER_STDAFX)
26+
string(APPEND EXTRA_FLAGS " -DINJECT_HEADER_AFTER_STDAFX=${INJECT_HEADER_AFTER_STDAFX}")
27+
endif()
28+
2529
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}")
2630
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_LDFLAGS}")
2731

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Below are instructions to build on different OS's. You can also use the followin
2323
| -DUSE_CPPRESTSDK | Includes the CppRestSDK (default http stack) | false |
2424
| -DWERROR | Enables warnings as errors | true |
2525
| -DWALL | Enables all warnings | true |
26+
| -DINJECT_HEADER_AFTER_STDAFX=`<header path>` | Adds the provided header to the library compilation in stdafx.cpp, intended to allow "new" and "delete" to be replaced. | `<none>` |
2627

2728
### Build on Windows ###
2829
```powershell

src/signalrclient/stdafx.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#include "stdafx.h"
5+
#include "stdafx.h"
6+
7+
#ifdef INJECT_HEADER_AFTER_STDAFX
8+
#include STRINGIFY(INJECT_HEADER_AFTER_STDAFX)
9+
#endif

src/signalrclient/stdafx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
#pragma once
66

7+
#define STRINGIFY_2(s) #s
8+
#define STRINGIFY(s) STRINGIFY_2(s)
9+
710
#ifdef _WIN32 // used in the default log writer and to build the dll
811

912
// prevents from defining min/max macros that conflict with std::min()/std::max() functions

0 commit comments

Comments
 (0)