Coder Social home page Coder Social logo

c-block-mysql's Introduction

Overview

c-block-mysql is a c-block wrapper of libmysql.

Dependences

Link libmysql in MinGW

Download mysql-connector-c-6.1.5-win32.msi and install.
Download http://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/pexports-0.46/pexports-0.46-mingw32-bin.tar.xz/download and extract pexports.exe to C:\MinGW\bin

;The following commands are run in msys environment
;Copy "C:\Program Files\MySQL\MySQL Connector C 6.1\lib\libmysql.dll" to /e/project/c-block-mysql/mingw
$ cd /e/project/c-block-mysql/mingw
$ pexports libmysql.dll>libmysql.def
$ dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a
e:\project\c-block-mysql/src/c-block-mysql.c:82: undefined reference to `mysql_real_connect@32'
e:\project\c-block-mysql/src/c-block-mysql.c:87: undefined reference to `mysql_options@12'
e:\project\c-block-mysql/src/c-block-mysql.c:92: undefined reference to `mysql_free_result@4'
e:\project\c-block-mysql/src/c-block-mysql.c:96: undefined reference to `mysql_real_query@12'
e:\project\c-block-mysql/src/c-block-mysql.c:100: undefined reference to `mysql_store_result@4'
e:\project\c-block-mysql/src/c-block-mysql.c:77: undefined reference to `mysql_init@4'
e:\project\c-block-mysql/src/c-block-mysql.c:102: undefined reference to `mysql_field_count@4'
src/test.o: In function `main':
e:\project\c-block-mysql/src/test.c:22: undefined reference to `mysql_server_init@12'
collect2.exe: error: ld returned 1 exit status
make: *** [test.exe] Error 1

Edit libmysql.def, replace mysql_real_connect with mysql_real_connect@32 ...
repeat step: dlltool ...

If you encounter this problem, please follow the steps below.

test.exe - Entry Point Not Found
The procedure entry point InitializeConditionVariable could not be located in the dynamic link library KERNEL32.dll. 

Download http://downloads.mysql.com/archives/get/file/mysql-connector-c-6.0.2-win32.msi and install.

;Copy "C:\Program Files\MySQL\MySQL Connector C 6.0.2\lib\opt\libmysql.dll" to /e/project/c-block-mysql/mingw
$ cd /e/project/c-block-mysql/mingw
$ pexports libmysql.dll>libmysql.def
$ dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a

Edit libmysql.def, replace mysql_real_connect with mysql_real_connect@32 ...
repeat step: dlltool ...

References:

  1. MySQL and MinGW
  2. Re: Using MinGW with MySQL on Windows

c-block-mysql's People

Contributors

huxingyi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.