enable system's my_malloc/calloc/realloc/free via compile time option

_v3_old
Nguyen Anh Quynh 11 years ago
parent f122ae0629
commit 59492c2688
  1. 5
      Makefile
  2. 6
      config.mk
  3. 7
      cs.c

@ -9,6 +9,11 @@ RANLIB ?= $(CROSS)ranlib
STRIP ?= $(CROSS)strip
CFLAGS += -fPIC -O3 -Wall -Iinclude
ifeq ($(USE_SYS_DYN_MEM),yes)
CFLAGS += -DUSE_SYS_DYN_MEM
endif
LDFLAGS += -shared
PREFIX ?= /usr

@ -1,3 +1,9 @@
# Comment out the line below 'USE_SYS_DYN_MEM = yes' if you do not want to use
# system's malloc()/calloc()/realloc()/free() for internal dynamic memory management.
# NOTE: in that case, your program must specify your own malloc/calloc/realloc/free
# functions with cs_option(), using CS_OPT_MEM option type.
USE_SYS_DYN_MEM = yes
# Specify which archs you want to compile in
CAPSTONE_ARCHS =

@ -16,10 +16,17 @@ void (*arch_destroy[MAX_ARCH]) (cs_struct *) = { NULL };
unsigned int all_arch = 0;
#ifdef USE_SYS_DYN_MEM
malloc_t my_malloc = malloc;
calloc_t my_calloc = calloc;
realloc_t my_realloc = realloc;
free_t my_free = free;
#else
malloc_t my_malloc = NULL;
calloc_t my_calloc = NULL;
realloc_t my_realloc = NULL;
free_t my_free = NULL;
#endif
unsigned int cs_version(int *major, int *minor)
{

Loading…
Cancel
Save