I want to use dll from ssdeep (http://ssdeep.sourceforge.net/). The API is:
int fuzzy_hash_buf(unsigned char *buf, uint32_t buf_len, char *result);
then in Delphi, i write it like this:
function fuzzy_hash_buf(buf : Pbyte; buf_len : Cardinal; result : PAnsiChar): integer; stdcall; external ‘fuzzy.dll’ name ‘fuzzy_hash_buf’;
How to use that function in Delphi?
Thanks!
If
fuzzy.dllexports a functionfuzzy_hash_bufwith the C declarationthen you are right that the Delphi declaration would be
To use this in Delphi, in the
interfacesection of a unit, writeThen, in the
implementationsection of the very same unit, you do not implement the function yourself, but rather point to the external DLL:Notice that you do not have to redeclare the parameters, the result type, and the calling convention (
stdcall).Now you can use this function as if it were an actual function of this unit. For instance, you might write
from any unit that
usesthe unit in which you declaredfuzzy_hash_buf.Update
I am afraid that I am not familiar enough with the CreateFileMapping function. However, after reading the MSDN documentation, I believe that you can do