Author Topic: SB Win64  (Read 2698 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
SB Win64
« on: March 20, 2014, 11:15:21 AM »
I'm trying to rebuild the MySQL extension module on Windows 7 64 bit. The MySQL I downloaded was built using VC10 and I need the libmysql.a to link to. I found this with a search but I don't have the tools needed with the TDB-GCC-64 compiler I'm using.

Code: [Select]
3. Mysql uses .dll's and .lib's that are incompatible with MinGW's linker. You will need to make a libmysql.a file for MinGW. To do this you will need the mingw-utils package. After you extract the package, copy reimp.exe to your MinGW\bin directory that you specified in your path. (same place dlltool.exe lives)
4. Then you will need to use the command prompt and go to your \path\to\msyqlinstall\lib\opt directory.
5. Run these two commands

reimp -d libmysql.lib

dlltool -k -d libmysql.def -l libmysql.a

@AIR - Where did you get your MySQL 64 bit when you built the SB 2.1 Windows 64 bit extension module?

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: SB Win64
« Reply #1 on: March 20, 2014, 04:05:32 PM »
I might have built it from source (libmysqlclient), but I don't know for sure.

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB Win64
« Reply #2 on: March 20, 2014, 04:15:36 PM »
I really think this a generic request as I'm sure all of us are going to run into the problem having MS VC## libraries that need to be linked with MinGW gcc compilers.

If you could put your wizard suit back on and show how this could be done, I'll vote for a national AIR day.  ;D
« Last Edit: March 20, 2014, 04:17:53 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB Win64
« Reply #3 on: March 20, 2014, 06:23:09 PM »
AIR,

I thought I could use your libmysql.a from the 2.1 SB build but there was only a folder with 32 bit versions of the libs. Not sure how 32 bit libraries got mixed in with a gcc 64 bit build of SB for Windows.

I found this Lib to A tool but it doesn't work with 64 bit libraries.  :-[
« Last Edit: March 20, 2014, 06:58:32 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB Win64
« Reply #4 on: March 20, 2014, 08:41:11 PM »
Got It!

Code: [Select]
C:\mysql-64\mysql-5.6.16-winx64\lib>gendef libmysql.dll
 * [libmysql.dll] Found PE+ image
C:\mysql-64\mysql-5.6.16-winx64\lib>dlltool -D libmysql.dll -d libmysql.def -l libmysql.a
C:\scriptbasic\source\extensions\mysql>mingw32-make -B
gcc -w -D_WIN32  -c -o ..\..\bin\mod\obj\mysql\s_interface.o  interface.c
ar -r ..\..\bin\mod\lib\mysql.a ..\..\bin\mod\obj\mysql\s_interface.o  c:\TDM-GCC-64\x86_64-w64-mingw32\lib\libmysql.a  c:\TDM-GCC-04\x86_64-w64-mingw32\lib\libws2_32.a c:\TDM-GCC-64\x86_64-w64-mingw32\lib\libadvapi32.a
gcc -w -D_WIN32  -c -o ..\..\bin\mod\obj\mysql\interface.o interface.c
gcc -Wno-write-strings -static-libgcc -pipe -shared -w -s -O2  -Wl,--add-stdcall-alias,--output-def,"..\..\bin\mod\dll\mysql_imp.def",--out-implib,"..\..\bin\mod\dll\mysql_imp.a" -s -o ..\..\bin\mod\dll\mysql.dll  ..\..\bin\mod\obj\mysql\interface.o -lmysql -lws2_32 -ladvapi32
C:\scriptbasic\source\extensions\mysql>

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB Win64
« Reply #5 on: March 20, 2014, 11:14:18 PM »
I'm happy. The Script BASIC project is 64 bit centric on both Windows and Linux platforms using the same source, common open source extension module libraries and gcc as the base compiler. I think Script BASIC is significantly ahead of the game in comparison to other so called popular BASIC  languages. The facts speak for themselves.

« Last Edit: March 21, 2014, 12:46:10 AM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB Win64
« Reply #6 on: March 21, 2014, 10:25:46 PM »
@AIR - I was able to get your SB SQLite3 extension module compiled under Windows 7 64 bit. I think this is the first time for this module. It wasn't included in your 2.1 build effort. I tested the ODBC extension module with the SQLite3 ODBC driver and it worked fine. The test verified that the SB ODBC interface is working and the MySQL ODBC driver has a bug. It chops off 5 or so characters off the front of the returned strings. The MySQL direct extension module works fine. I'm going to try the 32 bit MySQL ODBC driver and see if it works there.

Code: [Select]
import sqlite.bas

db = sqlite::open("testsql")

sqlite::execute(db,"create table demo (someval integer, sometxt text);")
sqlite::execute(db,"insert into demo values (123,'hello');")
sqlite::execute(db, "INSERT INTO demo VALUES (234, 'cruel');")
sqlite::execute(db, "INSERT INTO demo VALUES (345, 'world');")

stmt = sqlite::query(db,"SELECT * FROM demo")

while (sqlite::row(stmt) = sqlite::SQLITE3_ROW)
  if sqlite::fetchhash(stmt,column) then
    print column{"someval"},"\t-\t",column{"sometxt"},"\n"
  end if
wend

sqlite::close(db)

C:\scriptbasic\test>scriba t_sqlite3.sb
123     -       hello
234     -       cruel
345     -       world

C:\scriptbasic\test>
« Last Edit: March 21, 2014, 11:01:25 PM by John »