add new error code CS_ERR_MEMSETUP to report error when user-defined dynamic mem management is uninitialized
diff --git a/cs.c b/cs.c
index 284d31e..2e1e91e 100644
--- a/cs.c
+++ b/cs.c
@@ -38,7 +38,7 @@
 	return (CS_API_MAJOR << 8) + CS_API_MINOR;
 }
 
-bool cs_support(cs_arch arch)
+bool cs_support(int arch)
 {
 	if (arch == CS_ARCH_ALL)
 		return all_arch == ((1 << CS_ARCH_ARM) | (1 << CS_ARCH_ARM64) |
@@ -79,6 +79,8 @@
 			return "Invalid option (CS_ERR_OPTION)";
 		case CS_ERR_DETAIL:
 			return "Details are unavailable (CS_ERR_DETAIL)";
+		case CS_ERR_MEMSETUP:
+			return "Dynamic memory management uninitialized (CS_ERR_MEMSETUP)";
 	}
 }
 
@@ -86,6 +88,11 @@
 {
 	cs_struct *ud;
 
+	if (!my_malloc || !my_calloc || !my_realloc || !my_free)
+		// Error: before cs_open(), dynamic memory management must be initialized
+		// with cs_option(CS_OPT_MEM)
+		return CS_ERR_MEMSETUP;
+
 	ud = my_calloc(1, sizeof(*ud));
 	if (!ud) {
 		// memory insufficient