Skip to content

Instantly share code, notes, and snippets.

@earl
Created September 29, 2010 23:42
Show Gist options
  • Save earl/fa147ed65ee752b23133 to your computer and use it in GitHub Desktop.
Save earl/fa147ed65ee752b23133 to your computer and use it in GitHub Desktop.
diff --git a/make-gcc/makefile b/make-gcc/makefile
index 0e8d600..bddfeca 100644
--- a/make-gcc/makefile
+++ b/make-gcc/makefile
@@ -243,3 +243,8 @@ $O/graphics.o: $S/agg/graphics.cpp $(INCS)
$O/rich_text.o: $S/agg/rich_text.cpp $(INCS)
$C $(CFLAGS) -o $O/rich_text.o $S/agg/rich_text.cpp
+
+#--- Extension Libraries:
+
+$L/ext-odbc.dll: $S/os/win32/host-odbc.c $(INCS) $I/reb-host.h $I/host-lib.h $I/sys-net.h
+ $C -O1 -DUNICODE -fpack-struct -I $S/include -o $L/ext-odbc.dll $S/os/win32/host-odbc.c -shared -DODBC_DLL -luser32 -lodbc32
diff --git a/src/os/win32/host-odbc.c b/src/os/win32/host-odbc.c
index fe2a59c..96c3a66 100644
--- a/src/os/win32/host-odbc.c
+++ b/src/os/win32/host-odbc.c
@@ -343,7 +343,12 @@ SQLRETURN ODBC_FetchResults (RXIFRM *frm, SQLHSTMT hstmt, int num_columns,
/*******************************************************************************
**
-*/ RXIEXT int RXD_ODBC(int cmd, RXIFRM *frm, void *data)
+*/
+#ifndef ODBC_DLL
+ RXIEXT int RXD_ODBC(int cmd, RXIFRM *frm, void *data)
+#else
+ int RX_Call(int cmd, RXIFRM *frm, void *data)
+#endif
/*
** ODBC command extension dispatcher.
**
@@ -386,6 +391,7 @@ SQLRETURN ODBC_FetchResults (RXIFRM *frm, SQLHSTMT hstmt, int num_columns,
}
+#ifndef ODBC_DLL
/*******************************************************************************
**
*/ void Init_ODBC(void)
@@ -395,6 +401,23 @@ SQLRETURN ODBC_FetchResults (RXIFRM *frm, SQLHSTMT hstmt, int num_columns,
RL = (RL_LIB *)RL_Extend((REBYTE *)(&RX_odbc[0]), (RXICAL)&RXD_ODBC);
}
+#else
+
+RL_LIB *RL;
+
+/*******************************************************************************
+**
+*/ const char *RX_Init(int opts, RL_LIB *lib)
+/*
+** ODBC extension initialisation, if built as external DLL.
+**
+*******************************************************************************/
+{
+ RL = lib;
+ return RX_odbc;
+}
+#endif
+
/*******************************************************************************
**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment