Skip to content
⌘ NSIS Forum Archive

Calling external dll and returning value

2 posts

pillairohit#edited

Calling external dll and returning value

Hi.

In my installer I've made calls to a 3rd party dll in the following way :
<DLL_name>::<function_name> <parameters, if any>

I've made such calls directly, not using any plug-in or system call.

Now I want to call a function from a dll, which returns a value. So I do a 'pushstring(parameter_name, NSIS_MAX_STRLEN)' @ the end of the called function within the dll. There is only one string that I'm returning from the function to the dll.

However, I am not able to retrieve the value within NSIS. I tried to pop from stack using $0 and $R0, but to no avail.

I also tried using System::Call '<DLL_name>::<function_name>(t, *i) i(.r0, r1r1).r2'
But in that case, my dll ain't getting called at all.I'm not clear about how the parameters are returned if we use System::Call.

What am I doing wrong here? How do I make the call in NSIS?

Thanks.
Rohit.
MSG#
You cannot call a dll function using dllname::function. You can only call NSIS plugins that way.

All normal dll functions should be called using the System plugin. Read the System plugin readme for details on the parameter format. Or look for examples in google etc.