Skip to content

Instantly share code, notes, and snippets.

@hackathi
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save hackathi/5bc715c292a75e5eae3d to your computer and use it in GitHub Desktop.

Select an option

Save hackathi/5bc715c292a75e5eae3d to your computer and use it in GitHub Desktop.
libGee.External.Capstone.Proxy.so
CC = gcc # C compiler
CFLAGS = -DNOT_WIN -fPIC -Wall -Wextra -O2 -g # C flags
LDFLAGS = -shared # linking flags
RM = rm -f # rm command
TARGET_LIB = libGee.External.Capstone.Proxy.so # target lib
SRCS = proxy.c # source files
OBJS = $(SRCS:.c=.o)
.PHONY: all
all: ${TARGET_LIB}
$(TARGET_LIB): $(OBJS)
$(CC) ${LDFLAGS} -o $@ $^
$(SRCS:.c=.d):%.d:%.c
$(CC) $(CFLAGS) -MM $< >$@
include $(SRCS:.c=.d)
.PHONY: clean
clean:
-${RM} ${TARGET_LIB} ${OBJS} $(SRCS:.c=.d)
#include <capstone.h>
#if !defined(NOT_WIN)
#define DLLFOO __declspec(dllexport)
#else
#define DLLFOO
#endif
#if !defined(NOT_WIN)
extern "C" {
#endif
DLLFOO cs_arm* CapstoneArmDetail(cs_detail *detail) {
return &detail->arm;
}
DLLFOO cs_arm64* CapstoneArm64Detail(cs_detail *detail) {
return &detail->arm64;
}
DLLFOO cs_x86* CapstoneX86Detail(cs_detail *detail) {
return &detail->x86;
}
#if !defined(NOT_WIN)
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment