all: dataworks$(EXEC_SUFFIX)
dataworks$(EXEC_SUFFIX): $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) -ldataworks
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) ../Library/$(STATICLIB_PREFIX)dataworks$(STATICLIB_SUFFIX)
.c.o:
$(CC) -I../Library $(CFLAGS) -c -o $@ $<
printf("Bad database file or non-existent.\n");
return 1;
}
- printf("Opened the database (Version %d).\n", db->version);
+ printf("Opened the database (Version %d).\n", dataworks_database_get_version(db));
printf("\n");
printf("Type a command (.help) for the help\n");
printf("\n");
OBJS = parser.o database.o util.o dataworks.o
-all: $(LIB_PREFIX)dataworks$(LIB_SUFFIX)
+all: $(LIB_PREFIX)dataworks$(LIB_SUFFIX) $(STATICLIB_PREFIX)dataworks$(STATICLIB_SUFFIX)
$(LIB_PREFIX)dataworks$(LIB_SUFFIX): $(OBJS)
$(CC) -shared $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
+$(STATICLIB_PREFIX)dataworks$(STATICLIB_SUFFIX): $(OBJS)
+ $(AR) rcs $@ $(OBJS)
+
.c.o:
$(CC) $(CFLAGS) -DPLATFORM_M=\"$(PLATFORM_M)\" -DPLATFORM_P=\"$(PLATFORM_P)\" -fPIC -c -o $@ $<
uint16_t ver;
__dw_native_endian(be_ver, uint16_t, ver = __converted);
__dw_unlockfile(fp);
- struct dataworks_db* db = malloc(sizeof(*db));
- db->fp = fp;
- db->version = ver;
- return db;
+ if(ver == 1){
+ struct dataworks_db* db = malloc(sizeof(*db));
+ db->fp = fp;
+ db->version = ver;
+ return db;
+ }else{
+ fclose(fp);
+ return NULL;
+ }
+}
+
+int dataworks_database_get_version(struct dataworks_db* db){
+ return db->version;
}
*/
struct dataworks_db* dataworks_database_open(const char* fname);
+/**
+ * @~english
+ * @brief Get the version of the database.
+ * @param db Database
+ * @return Version of the database
+ *
+ */
+int dataworks_database_get_version(struct dataworks_db* db);
+
#ifdef __cplusplus
}
#endif
include common-decl.mk
.if "$(PLATFORM)" != ""
-.include Platforms/$(PLATFORM).mk
+include Platforms/$(PLATFORM).mk
.endif
include common.mk
CC = i686-w64-mingw32-gcc
+AR = i686-w64-mingw32-gcc-ar
LIB_PREFIX =
LIB_SUFFIX = .dll
EXEC_SUFFIX = .exe
+STATICLIB_PREFIX =
+STATICLIB_SUFFIX = .a
PLATFORM_M = i686
PLATFORM_P = i686
CC = x86_64-w64-mingw32-gcc
+AR = x86_64-w64-mingw32-gcc-ar
LIB_PREFIX =
LIB_SUFFIX = .dll
EXEC_SUFFIX = .exe
+STATICLIB_PREFIX =
+STATICLIB_SUFFIX = .a
PLATFORM_M = x86_64
PLATFORM_P = x86_64
# $Id$
CC = cc
+AR = gcc-ar
CFLAGS = -std=c99 -D_DEFAULT_SOURCE
LDFLAGS = -L`pwd`/Library
LIBS =
LIB_PREFIX = lib
LIB_SUFFIX = .so
+STATICLIB_PREFIX = lib
+STATICLIB_SUFFIX = .a
EXEC_SUFFIX =
PLATFORM_M = `uname -m`
PLATFORM_P = `uname -p`
mkdir -p dataworks-dist/Library
mkdir -p dataworks-dist/Document
cp Library/*$(LIB_SUFFIX) dataworks-dist/Library/
+ cp Library/*$(STATICLIB_SUFFIX) dataworks-dist/Library/
cp Library/*.h dataworks-dist/Library/
cp Client/dataworks$(EXEC_SUFFIX) dataworks-dist/Client/
cp -rf Document/doc/html dataworks-dist/Document/html