- Creating a ready-made Expert Advisor - MQL4/MQL5 Wizard
- Where to Find Trading Robots and Indicators - Algorithmic Trading, Trading Robots
- Working with C++ DLL (integration with MS Visual Studio) - Developing programs
I tried with C++, exactly the same code in https://www.mql5.com/en/articles/18. Below is the message I get.
2016.05.19 21:08:38.642 2012.01.02 02:00 Cannot load 'CDLLsample.dll' [126]
I tried changing MFU as described in comments, and also compiled with x64, still the same error code 126.

- 2010.01.27
- Renat Fatkhullin
- www.mql5.com
I tried with C++, exactly the same code in https://www.mql5.com/en/articles/18. Below is the message I get.
2016.05.19 21:08:38.642 2012.01.02 02:00 Cannot load 'CDLLsample.dll' [126]
I tried changing MFU as described in comments, and also compiled with x64, still the same error code 126.

- www.mql5.com
I have worked on a simple DLL for mt4 by using visual studio 2013 c#. I added RGiesecke modules by using NuGet packeges. I can call simple procedures when it has only integer values. But when the function in the library has string values, mt4 cant find the function. Also, it makes wrong results for double or floating math operations. Does anyone have any experience on c# - mt4 connections.
Thank you for the answer. I found that registering the directories of libraries are not enough. One must copy all necessary lib and dll files to expert directory. Aso, it is not enough to copy them to include directory. But still there are strange problems that has to be solved. I can return integer, double or any number. However, I can not return back a string.
Answer is mql4_ansi2unicode. You can google this for more information.
Hi Anton.
Happy to see you. I compile with 86.
I noticed Foating values are also passed wrong to mt4. Only integers are being sent correctly. What d you think the reason is?
Hi Anton.
Happy to see you. I compile with 86.
I noticed Foating values are also passed wrong to mt4. Only integers are being sent correctly. What d you think the reason is?
What about "double" instead of "float"?
Same. It sends a value but the value is not as expected.
What does the value look like? Example?
Thank you very much Anton. I solved the problem about strings. I did not work on double and float problem yet, because I have another issue. I try to export a DLL function to mt4. The red line gives an error message when trying to load to mt4: Unhandled exception 0xE0434352.
[DllExport("readmysql", CallingConvention = CallingConvention.StdCall)]
public static string readmysql(string databasename, string tablename, string refereanceword, string columnname, string lookupcolumn)
{
string myConnectionString = "server=localhost;uid=root;" + "pwd=000000;database=trytabase;";
MySqlCommand mcd;
MySqlDataReader mdr;
string getvalue;
MySql.Data.MySqlClient.MySqlConnection conn;
conn = new MySql.Data.MySqlClient.MySqlConnection();
conn.ConnectionString = myConnectionString;
I appreciate any comment on that matter

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use