简体   繁体   English

vb6调用C API-MySQL Embedded

[英]vb6 Calling C API - MySQL Embedded

I am trying to connect to MySQL 5.5.48 with Embedded Server through VB6 calling conventions but doesn't know How to do it? 我正在尝试通过VB6调用约定连接到具有嵌入式服务器的MySQL 5.5.48,但不知道该怎么做?

The MySQL document say's calling of before calling to MySql_Init MySQL文件说在调用MySql_Init之前的调用

int mysql_server_init(int argc, char **argv, char **groups)

The Online example give the following Code in C: 在线示例在C语言中给出以下代码:

static char *server_args[] = {
  "this_program",       /* this string is not used */
  "--datadir=.",
  "--key_buffer_size=32M"
};

static char *server_groups[] = {
  "embedded",
  "server",
  "this_program_SERVER",
   (char *)NULL
};

if (mysql_server_init(sizeof(server_args) / sizeof(char *),
                    server_args, server_groups)) {
//Error Message
}

I have tried to declare function as: 我试图将函数声明为:

Public Declare Sub mysql_server_init Lib "libmySQLd" (ByVal _
    lMYSQL As Long, ByVal abc As Long, ByVal def As Long)

or 要么

Public Declare Sub mysql_server_init Lib "libmySQLd" (ByVal _
    lMYSQL As Long, ByVal abc As String, ByVal def As String)

and calling 并打电话

 call mysql_server_init(0, NULL, NULL)

or 要么

 call mysql_server_init(0, chr(0), chr(0))

but the program is craching. 但是程序正在抓紧时间。 Kindly Help me with proper calling convention between vb6 and C 请帮助我在vb6和C之间正确的调用约定

Reliably calling C DLLs from VB6 is a non-trivial process. 从VB6可靠地调用C DLL是不平凡的过程。 Check out this project , which provides VB6 the ability to call pretty much any function from any standard DLL or COM object. 签出该项目该项目使VB6能够从任何标准DLL或COM对象调用几乎所有函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM