I
Dont believe you need the path, just the filename (with extension) - if its in the <right> libraries folder :)
Good Luck
-BB-
Dont believe you need the path, just the filename (with extension) - if its in the <right> libraries folder :)
Both libmysql.dll and mysql_wrapper.dll are in the same folder as the EA, the Experts folder. Not in Experts/Libraries/.
Should I move them there? Aslo I notice there is no #import libmysql.dll in the EA, but you say it is needed to load the EA properly, should I add an import for it in the EA code?
Would the fact that I installed MT4 on my C drive folder instead of in the standard Programs folder have anythingt o do with this error?
It really makes no sense to me. JJC is right, this code was written by somebody else and the link he put up is the right one. I would have to assume that the author and the other posters in that thread got this to work somehow....?
Both libmysql.dll and mysql_wrapper.dll are in the same folder as the EA, the Experts folder. Not in Experts/Libraries/.
mysql_wrapper.dll should definitely be in either the experts\libraries directory or somewhere on the system path. Putting it in the same directory as the EA will not work. That, quite simply, is almost certainly your problem, as BB had already guessed.
I know nothing about MySQL (see above), but libmysql.dll should either be in the same directory as mysql_wrapper.dll or, preferably, somewhere on the system path.
("System path" can basically be taken to mean the system directory. On 32-bit versions of Windows, this is usually \Windows\System32. On 64-bit versions of Windows the correct directory in this context is usually \Windows\SysWOW64, not \Windows\System32, for reasons which I'm not going to go into here.)
Aslo I notice there is no #import libmysql.dll in the EA, but you say it is needed to load the EA properly, should I add an import for it in the EA code?
No, you don't need to do that: libmysql.dll is loaded implicitly by mysql_wrapper.dll and using #import on it will make no difference. mysql_wrapper.dll will fail to load if it (or, strictly speaking, the operating system) is unable to find libmysql.dll. Nothing you do within your EA will affect this.
IDK, this is mind bogling. I placed mysql_wrapper.dll in windows\system32. Now I get the same error message, except for the error code number, instead of 126, now i get error 127.
This is driving me crazy.!!!!!!!! <PULLS OUT HAIR>
I put together a zipfile of the source files and library files below. I left my real SQL login info in the mqh file so everybody else can check to see if they can get this to work, I can easily change them later. Dont fill the database up with toooo much garbage lol!
Also, here's the c++ file for mysql_wrapper. Other than mysql.h, which came in the original authors zip file, it looks like it includes a number of files that I have no idea what they are or where i can find them:
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include "mysql.h"
maybe these files have to be in the libraries folder?
//+------------------------------------------------------------------+ //| mysql_wrapper.c++ | //| Copyright © 2008, Berkers Trading | //| http://quotar.com | //+------------------------------------------------------------------+ #include "stdafx.h" #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <windows.h> #include <stdlib.h> #include <stdio.h> #include "mysql.h" //---- #define MT4_EXPFUNC __declspec(dllexport) struct MqlStr{ int len; char *string; }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) { //---- switch(ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } //---- return(TRUE); } MT4_EXPFUNC char* __stdcall MT4_mysql_wrapper_version(){ return("mysql_wrapper v1.0.1 Copyright © 2008, Berkers Trading"); } MT4_EXPFUNC void __stdcall MT4_mysql_fetch_row(MYSQL_RES* res, MqlStr *row){ //char buffer [50]; //sprintf (buffer, "%d ", sizeof(MqlStr)); //MessageBox(NULL,buffer,"Application Message", MB_OK | MB_ICONINFORMATION); MYSQL_ROW lrow = mysql_fetch_row(res); for (unsigned int i=0; i < mysql_num_fields(res);i++){ row[i].string = lrow[i]; } } /* my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); my_bool STDCALL mysql_eof(MYSQL_RES *res); MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, unsigned int fieldnr); */ MT4_EXPFUNC void __stdcall MT4_mysql_fetch_fields_string(MYSQL_RES* res, MqlStr *row, int type){ MYSQL_FIELD *lrow = mysql_fetch_fields(res); for (unsigned int i=0; i < mysql_num_fields(res);i++){ //MessageBox(NULL,lrow[i].name,"Application Message", MB_OK | MB_ICONINFORMATION); switch (type){ case 0: row[i].string = lrow[i].name; /* Name of column */ break; case 1: row[i].string = lrow[i].org_name; /* Original column name, if an alias */ break; case 2: row[i].string = lrow[i].table; /* Table of column if column was a field */ break; case 3: row[i].string = lrow[i].org_table; /* Org table name, if table was an alias */ break; case 4: row[i].string = lrow[i].db; /* Database for table */ break; case 5: row[i].string = lrow[i].catalog; /* Catalog for table */ break; case 6: row[i].string = lrow[i].def; /* Default value (set by mysql_list_fields) */ break; } } } /* MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res); MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res); unsigned int STDCALL mysql_field_count(MYSQL *mysql); my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); unsigned int STDCALL mysql_errno(MYSQL *mysql); const char * STDCALL mysql_error(MYSQL *mysql); const char *STDCALL mysql_sqlstate(MYSQL *mysql); unsigned int STDCALL mysql_warning_count(MYSQL *mysql); const char * STDCALL mysql_info(MYSQL *mysql); unsigned long STDCALL mysql_thread_id(MYSQL *mysql); const char * STDCALL mysql_character_set_name(MYSQL *mysql); int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);*//* MT4_EXPFUNC MYSQL* __stdcall _mysql_init(void){ MYSQL *mysql_res = mysql_init(0); return(mysql_res); } my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher); const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql); my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, const char *passwd, const char *db); *//* MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag); int STDCALL mysql_select_db(MYSQL *mysql, const char *db); int STDCALL mysql_query(MYSQL *mysql, const char *q); int STDCALL mysql_send_query(MYSQL *mysql, const char *q, unsigned long length); int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length); MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); */
Also, here's the original authors zipfile, full of .cnf, .plg, .dsw, .ilf files and a bunch of other stuff that I have no idea what they do. In other words, hopefully, everything we need should be here, except the libmysql.dll file, which is in my zipfile in the post above this one.
bump
inkexit:
maybe these files have to be in the libraries folder?
No. These are C source code (header) files that were included when the DLL was compiled. When you have the compiled DLL the C source does not matter anymore at this point. Its all inside the dll now.
Put the wrapper dll into the experts/libraries folder as you have been instructed already (but refused to do) and remove the full path from your #import statement. It must read #import "mysql_wapper.dll" and nothing else. And if you have properly installed MySQL (the correct version!) on your PC then you should already have libmysql.dll in the correct place.
Do not deviate from the instructions for no reason and then ask why it is not working.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
2010.07.01 15:33:22 mysql_v2.2 AUDJPYFXF,H1: cannot load library 'C:\MT4\experts\libraries\mysql_wrapper.dll' (error 126)
I keep getting this error when I try to place this EA on a chart. The dll is in the folder it's supposed to be and I'm running this EA on my home PC. Completely lost here.