cmake: properly export public APIs in capstone.DLL. thanks to Daniel Pistelli for helping to fix this issue
diff --git a/cs.c b/cs.c
index 21ca39d..08cf8e3 100644
--- a/cs.c
+++ b/cs.c
@@ -87,6 +87,7 @@
cs_vsnprintf_t cs_vsnprintf = NULL;
#endif
+CAPSTONE_EXPORT
unsigned int cs_version(int *major, int *minor)
{
archs_enable();
@@ -99,6 +100,7 @@
return (CS_API_MAJOR << 8) + CS_API_MINOR;
}
+CAPSTONE_EXPORT
bool cs_support(int query)
{
archs_enable();
@@ -132,6 +134,7 @@
return false;
}
+CAPSTONE_EXPORT
cs_err cs_errno(csh handle)
{
struct cs_struct *ud;
@@ -143,6 +146,7 @@
return ud->errnum;
}
+CAPSTONE_EXPORT
const char *cs_strerror(cs_err code)
{
switch(code) {
@@ -175,6 +179,7 @@
}
}
+CAPSTONE_EXPORT
cs_err cs_open(cs_arch arch, cs_mode mode, csh *handle)
{
cs_err err;
@@ -219,6 +224,7 @@
}
}
+CAPSTONE_EXPORT
cs_err cs_close(csh *handle)
{
struct cs_struct *ud;
@@ -345,6 +351,7 @@
}
}
+CAPSTONE_EXPORT
cs_err cs_option(csh ud, cs_opt_type type, size_t value)
{
struct cs_struct *handle;
@@ -415,6 +422,7 @@
// dynamicly allocate memory to contain disasm insn
// NOTE: caller must free() the allocated memory itself to avoid memory leaking
+CAPSTONE_EXPORT
size_t cs_disasm_ex(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
{
struct cs_struct *handle = (struct cs_struct *)(uintptr_t)ud;
@@ -569,6 +577,7 @@
return c;
}
+CAPSTONE_EXPORT
void cs_free(cs_insn *insn, size_t count)
{
size_t i;
@@ -582,6 +591,7 @@
}
// return friendly name of regiser in a string
+CAPSTONE_EXPORT
const char *cs_reg_name(csh ud, unsigned int reg)
{
struct cs_struct *handle = (struct cs_struct *)(uintptr_t)ud;
@@ -593,6 +603,7 @@
return handle->reg_name(ud, reg);
}
+CAPSTONE_EXPORT
const char *cs_insn_name(csh ud, unsigned int insn)
{
struct cs_struct *handle = (struct cs_struct *)(uintptr_t)ud;
@@ -616,6 +627,7 @@
return false;
}
+CAPSTONE_EXPORT
bool cs_insn_group(csh ud, cs_insn *insn, unsigned int group_id)
{
struct cs_struct *handle;
@@ -642,6 +654,7 @@
return arr_exist(insn->detail->groups, insn->detail->groups_count, group_id);
}
+CAPSTONE_EXPORT
bool cs_reg_read(csh ud, cs_insn *insn, unsigned int reg_id)
{
struct cs_struct *handle;
@@ -668,6 +681,7 @@
return arr_exist(insn->detail->regs_read, insn->detail->regs_read_count, reg_id);
}
+CAPSTONE_EXPORT
bool cs_reg_write(csh ud, cs_insn *insn, unsigned int reg_id)
{
struct cs_struct *handle;
@@ -694,6 +708,7 @@
return arr_exist(insn->detail->regs_write, insn->detail->regs_write_count, reg_id);
}
+CAPSTONE_EXPORT
int cs_op_count(csh ud, cs_insn *insn, unsigned int op_type)
{
struct cs_struct *handle;
@@ -769,6 +784,7 @@
return count;
}
+CAPSTONE_EXPORT
int cs_op_index(csh ud, cs_insn *insn, unsigned int op_type,
unsigned int post)
{