dingmaotu / mql-sqlite3

SQLite3 binding for the MQL language (both 32bit MT4 and 64bit MT5)
MIT License
60 stars 36 forks source link

Where does the DLL go? #3

Open eabase opened 3 years ago

eabase commented 3 years ago

You say in the readme that the DLL should go into the Library directory, but you don't say where that is ocated. MT4 only has a Libraries directory located under: "C:\Users\<Username>\AppData\Roaming\MetaQuotes\Terminal\<hash>\MQL4\Libraries\.

So what is it?

eabase commented 3 years ago

Ok. Here's the solution.

Because MT4 is a 32-bit binary the DLL also have to be the 32-bit version. So even if your Windows installation have dozens of sqlite3.dll files here and there, they are mostly 64-bit version, and you can't use them. However, as long as they are the 32-bit versions, you can just copy it to the C:\Users\<Username>\AppData\Roaming\MetaQuotes\Terminal\<hash>\MQL4\Libraries\ directory. (Or use the one supplied in this repo if you trust it.)

Next, make sure you refresh and compile the TestSQLite3.mq4 file, before adding it to the chart. Once added it will run and finsih immediately. The resulting SQLIte DB file will now be located in: C:\Users\<username>\AppData\Roaming\MetaQuotes\Terminal\<hash>\MQL4\Files\test.db

You can test in powershell with:

if(get-content .\sqlite3.dll -totalcount 50 | select-string -Pattern "PE..L" -Quiet) {Write-Host "32-bit binary: OK"}