OK, I solved the problem.
It was some kind of "buffer overflow" error (though I still have no idea why mIRC was crashing only when the DLL was called "remotely").
If someone find it useful, here's the link:
mircfs.dllThe function is called by:
$dll("mircfs_2.dll",Memory,"path_to_textfile" "some word")
The path and word must be given in quotes.
This function searches a text file in this form:
for a given word (note that first line in the file should be empty), and returns "found", "not found", "file not found" (if there's any error opening the file) or "unknown error". It is based on the code downloaded from this site:
http://www.arstdesign.com/articles/fastsearch.html On my computer, searching for the last from a list of over 2,700,000 words takes ~220ms