Skip to content

Commit 82c84e7

Browse files
committed
Added base library with scl_memmgr implementation.
* scl_memmgr supports both c and c++ memory management. malloc, calloc, realloc and free for c. new, delete operators for c++. (in c++ files scl_memmgr.h should be included last because a macro is used to replace new and delete with scl versions. If not included last, this would break build.)
1 parent 4d68ec0 commit 82c84e7

File tree

5 files changed

+515
-0
lines changed

5 files changed

+515
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ include_directories(
258258
${SCL_BINARY_DIR}/include
259259
)
260260

261+
ADD_SUBDIRECTORY(src/base)
261262
ADD_SUBDIRECTORY(src/express)
262263
ADD_SUBDIRECTORY(src/exppp)
263264
ADD_SUBDIRECTORY(src/fedex_plus)

include/scl_export.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
#ifndef SCL_EXPORT_H
22
#define SCL_EXPORT_H
33

4+
/* Import/Export flags for base. */
5+
#ifndef SCL_BASE_EXPORT
6+
# if defined(SCL_BASE_DLL_EXPORTS) && defined(SCL_BASE_DLL_IMPORTS)
7+
# error "Only SCL_BASE_DLL_EXPORTS or SCL_BASE_DLL_IMPORTS can be defined, not both."
8+
# elif defined(SCL_BASE_DLL_EXPORTS)
9+
# define SCL_BASE_EXPORT __declspec(dllexport)
10+
# elif defined(SCL_BASE_DLL_IMPORTS)
11+
# define SCL_BASE_EXPORT __declspec(dllimport)
12+
# else
13+
# define SCL_BASE_EXPORT
14+
# endif
15+
#endif
16+
417
/* Import/Export flags for express. */
518
#ifndef SCL_EXPRESS_EXPORT
619
# if defined(SCL_EXPRESS_DLL_EXPORTS) && defined(SCL_EXPRESS_DLL_IMPORTS)

src/base/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
set(SCL_BASE_SOURCES
3+
scl_memmgr.cc
4+
)
5+
6+
include_directories(
7+
${SCL_SOURCE_DIR}/include
8+
)
9+
10+
option(SCL_MEMMGR_ENABLE_CHECKS "Enable scl_memmgr's memory leak detection" OFF)
11+
12+
if(MSVC OR BORLAND)
13+
add_definitions( -DSCL_BASE_DLL_EXPORTS )
14+
endif()
15+
16+
if (${SCL_MEMMGR_ENABLE_CHECKS})
17+
add_definitions( -DSCL_MEMMGR_ENABLE_CHECKS )
18+
endif()
19+
20+
SCL_ADDLIB(base "${SCL_BASE_SOURCES}" "")

0 commit comments

Comments
 (0)