Jump to content
Sign in to follow this  

passing file pointer to c dll in dllcall

Recommended Posts


in calls to winapi file handle passes as HANDLE and all ok.

but in plain C it may be FILE*


RHASH_API void rhash_run_benchmark(unsigned hash_id, unsigned flags,
                   FILE* output);

calls like

  Local $aResult = DllCall("librhash.dll", "none:cdecl", "rhash_run_benchmark", _
    "uint", $hash_id, _
    "uint", $flags, _
    "handle", $output)


(i try handle, handle*, ptr, ptr*, hwnd, hwnd*, ....)

may be someone know solution ?

Share this post

Link to post
Share on other sites

the solution is modify source c dll code (write wrapper c func)

like this

void rhash_run_benchmark_mod(unsigned hash_id, unsigned flags, const char* output)
    FILE* f = fopen(output, "wb");
    rhash_run_benchmark(hash_id, flags, f);

not the case if no source code for dll :)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this