What version of ooRexx are you using. I see you are compiling a 32 bit
version os ooSQLite, are you also using a 32bit version of ooRexx?
Bruce
On Sep 14, 2012, at 9:55 AM, Staffan Tylen wrote:
> Over the last 2 days I've tried to compile and link my own version of
> ooSQLite.dll using MinGW GCC but when I try to load it using ::REQUIRE it
> fails with:
>
> 1 *-* ::REQUIRES "oosqlite" LIBRARY
> Error 98 running C:\...\bin\testdll.rex line 1: Execution error
> Error 98.903: Unable to load library "oosqlite"
>
> The bin folder contains:
> oosqlite3.exe
> oosqlite.dll
> testdll.cmd
> testdll.rex
>
> testdll.cmd contains:
> path %CD%;%PATH%
> rexx testdll.rex
>
> testdll.rex contains:
> ::requires 'oosqlite' library
>
> In comparison, I've successfully compiled and linked SQLite (not ooSQLite)
> using the following cmd file:
>
> @rem ------------- Compile SQLite (32-bit)
>
> mkdir temp
> path \mingw\bin;%PATH%
>
> @rem ------------- Create sqlite3.dll
>
> gcc -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -D
> SQLITE_ENABLE_COLUMN_METADATA -D SQLITE_ENABLE_MEMORY_MANAGEMENT -O2 -o
> temp/sqlite3.o -c sqlite3.c
> gcc -o sqlite3.dll -s -shared temp/sqlite3.o -W1,--subsystem,windows
>
> @rem ------------- Create sqlite3.exe
>
> gcc -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -D
> SQLITE_ENABLE_COLUMN_METADATA -D SQLITE_ENABLE_MEMORY_MANAGEMENT -O2 -o
> temp/shell.o -c shell.c
> gcc -o sqlite3.exe -s temp/shell.o -L. -l sqlite3 -W1,--subsystem,windows
>
> @rem del temp\*.* /Q
> @rem rmdir temp
>
> I've verified that the SQLite DLL is working using the following Rexx/SQL
> statements:
>
> Call RXFuncAdd "SQLLoadFuncs", "rexxsql", "SQLLoadFuncs"
> Call SQLLoadFuncs
> say sqlconnect("s1","","","")
> say sqlcommand(c1,"CREATE TABLE AA (A,B);")
>
> Return code 0 is returned in all cases.
>
> ooSQLite seems to be a different beast and maybe it's because there is a
> mixture of C and C++ code, I don't know. (Please note that I have no C or C++
> background whatsoever so this is all new to me.)
>
> This is the compile suite that I'm running (I've created a copy of the SVN
> source tree in SVN32 where I've applied the source changes mentioned below.
> I've also copied the ooRexx API folder into the SVN32\src folder):
>
> rem ============================= ooSQLite compile
> ============================
>
> path C:\MinGW\bin
>
> mkdir temp
>
> rem ============== Compile 'APICommon.cpp' ====================
>
> g++ -O2 -m32 -c SVN32\src\APICommon.cpp -o temp/APICommon.o -I
> SVN32/src/ -I SVN32/src/sqlite/ -I SVN32/src/platform/windows/ -I
> SVN32/src/ooRexxAPI/ -D W3 -D _CRT_SECURE_NO_DEPRECATE -D
> _CRT_NONSTDC_DEPRECATE -D OOSQLITE_VER_MAJOR=1 -D OOSQLITE_VER_MINOR=0 -D
> OOSQLITE_VER_LEVEL=0 -D OOSQLITE_VER_BUILD=0 -D OOSQLITE_VER_STR="1.0.0" -D
> OOSQLITE_COPYRIGHT_YEAR="2012-2012"
>
> rem ============== Compile 'ooSQLite.cpp' =====================
>
> g++ -O2 -m32 -c SVN32\src\ooSQLite.cpp -o temp/ooSQLite.o -I
> SVN32/src/ -I SVN32/src/sqlite/ -I SVN32/src/ooRexxAPI/ -D
> SQLITE_THREADSAFE=1 -D SQLITE_ENABLE_FTS4 -D SQLITE_ENABLE_RTREE -D
> SQLITE_ENABLE_COLUMN_METADATA -D SQLITE_ENABLE_MEMORY_MANAGEMENT -D W3 -D
> _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_DEPRECATE -D OOSQLITE_VER_MAJOR=1 -D
> OOSQLITE_VER_MINOR=0 -D OOSQLITE_VER_LEVEL=0 -D OOSQLITE_VER_BUILD=0 -D
> OOSQLITE_VER_STR="1.0.0" -D OOSQLITE_COPYRIGHT_YEAR="2012-2012"
>
> rem ============== Compile 'SQLite.c' =====================
>
> gcc -O2 -m32 -c SVN32\src\sqlite\sqlite3.c -o temp/sqlite.o -I
> SVN32/src/ -I SVN32/src/sqlite/ -I SVN32/src/ooRexxAPI/ -D
> SQLITE_THREADSAFE=1 -D SQLITE_ENABLE_FTS4 -D SQLITE_ENABLE_RTREE -D
> SQLITE_ENABLE_COLUMN_METADATA -D SQLITE_ENABLE_MEMORY_MANAGEMENT
>
> rem ============== Compile 'shell.c' =====================
>
> gcc -O2 -m32 -c SVN32\src\sqlite\shell.c -o temp/shell.o -I SVN32/src/
> -I SVN32/src/sqlite/ -I SVN32/src/ooRexxAPI/ -D SQLITE_THREADSAFE=1 -D
> SQLITE_ENABLE_FTS4 -D SQLITE_ENABLE_RTREE -D SQLITE_ENABLE_COLUMN_METADATA -D
> SQLITE_ENABLE_MEMORY_MANAGEMENT
>
> rem ============== Create 'libooSQLite.a' ==============
>
> ar rcs temp/liboosqlite.a temp/*.o
>
> rem ============== Create 'bin\ooSQLite.dll' ==============
>
> gcc -m32 -o bin\oosqlite.dll -s -shared -Ltemp -l ooSQLite
>
> rem ============== Create 'bin\ooSQLite3.exe' ===============
>
> gcc -m32 -o bin\ooSQLite3.exe -s -Ltemp -l ooSQLite
>
> del temp\*.* /Q
> rmdir temp
>
> I should mention here that I've had to make some modifications to a few files
> in order to get a clean compile:
>
> APICommon.cpp:
> Added the following declaration to the rxStr2Number function:
> unsigned __int64 _strtoui64(
> const char *nptr,
> char **endptr,
> int base
> );
>
> rexxapitypes.h:
> #include <ctype.h> /* <<<<<<<<<<<<<<<<<<<
> added this include */
> /*typedef SSIZE_T ssize_t; <<<<<<<<<<<<<<<<<<<
> commented out */
> /*#define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< commented out */
>
> winOS.hpp:
> /* #define _WIN32_WINNT 0x0600 <<<<<<<<<<<<<<<<<< commented out */
> /* #define WINVER 0x0501 <<<<<<<<<<<<<<<<<< commented out */
>
> Again I try to verify the resulting DLL by running the following:
>
> testdll.cmd:
> path %CD%;%PATH%
> rexx testdll.rex
>
> testdll.rex:
> ::requires "oosqlite" library
>
> But I keep getting the error stated at the beginning of this (unfortunately
> long) note. (BTW the oosqlite3.exe file works fine.)
>
> objdump -f shows the following:
> oosqlite.dll: file format pei-i386
> architecture: i386, flags 0x00000103:
> HAS_RELOC, EXEC_P, D_PAGED
> start address 0x6ca41058
>
> objdump -f against the working sqlite3.dll shows:
> sqlite3.dll: file format pei-i386
> architecture: i386, flags 0x00000103:
> HAS_RELOC, EXEC_P, D_PAGED
> start address 0x6b0c1058
>
> I can hear the question: why not use Visual C++? The answer is that without
> any C/C++ background it complicates things for me even more.
> I've tried to use MSYS but with no success there either so I just go for the
> raw g++ and gcc commands. After all, I'm developing in Rexx, not C.
>
> Anybody out there who can draw a conclusion from this? I'm sure the answer is
> just there right in front of me but I just can't see it.
>
> Many thanks.
> Staffan
>
> ------------------------------------------------------------------------------
> Got visibility?
> Most devs has no idea what their production app looks like.
> Find out how fast your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219671;13503038;y?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html_______________________________________________
> Oorexx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users