Mysql c api call instance

Source: Internet
Author: User

These days I want to debug erlang's nif call c cpi, So I downloaded the source code. I mainly want to generate a mysql_nif.dll Link Library.
Win:
Decompress the source code and run libmysql In the lib directory. dll, libmysql. lib, mysqlclient. the three lib files are quite strange. Then, I asked my colleague da for a moment, and found that if I used the link libmysql. lib must have libmysql under the same directory of the generated dll. dll. If mysqlclient. lib is used, the link must be added to the Code.
# Pragma comment (linker, "/nodefaultlib: LIBCMT. lib ")
# Pragma comment (linker, "/nodefalib lib: MSVCRTD. lib ").
Then, configure the attributes in vs2010 to generate mysql_nif.dll ..

In linux:
It's easy to compile as follows.
Gcc-fPIC-shared-o mysql_nif.so mysql_nif.c-I/usr/local/mysql/include/mysql-L/usr/local/mysql/lib/mysql-l mysqlclient-I/usr /local/lib/erlang/erts-5.8/include

Related Article

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.