Example of a MySQL C API call

Source: Internet
Author: User

These days want to debug Erlang nif call C CPI so download the source code, the main want to generate a Mysql_nif.dll link library.
Win under:
Extract source code out, Lib directory under Libmysql.dll, Libmysql.lib, Mysqlclient.lib three files, feel very strange, and then asked Tatsu da colleagues also GG a bit, and found that if you use link libmysql.lib, you must have Libmysql.dll in the same directory as the build DLL. If you use Mysqlclient.lib, the code must be linked
#pragma COMMENT (linker, "/nodefaultlib:libcmt.lib")
#pragma COMMENT (linker, "/nodefaultlib:msvcrtd.lib").
Then the VS2010 configuration properties can be generated mysql_nif.dll ...

Under Linux:
Simpler, press the following compile.
Gcc-fpic-shared-o mysql_nif.so mysql_nif.c-i/usr/local/mysql/include/mysql-l/usr/local/mysql/lib/mysql-l mysqlcli Ent-i/usr/local/lib/erlang/erts-5.8/include




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.