From WikiChip
Difference between revisions of "mirc/commands/dll"
< mirc‎ | commands

(Example)
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{mirc title|/dll Command}}
 
The '''/dll command''' can be used to call an [[exported function]] from [[DLL]] with the specified parameters.
 
The '''/dll command''' can be used to call an [[exported function]] from [[DLL]] with the specified parameters.
  
Line 7: Line 8:
 
== Switches ==
 
== Switches ==
 
* '''-u''' - Unload the given loaded library.
 
* '''-u''' - Unload the given loaded library.
 +
 +
'''Note''': if you pass only a filename, (for example "test.dll", instead of /folder/test.dll or c:\fullpath\test.dll), /dll -u will begin with N=1 looking into the whole list of dlls for a match between $nopath($dll(Nth)) instead of looking into $mircdir only or looking in $mircdir first.
  
 
== Parameters ==
 
== Parameters ==
Line 13: Line 16:
 
* '''[data]''' - The data to pass to that function.
 
* '''[data]''' - The data to pass to that function.
  
== Example ==
+
Note: If the path or filename contains a space, <libName.dll> MUST be enclosed in doublequotes.
 +
 
 +
== Examples ==
 +
 
 +
Look at the {{mIRC|dll|dll}} article to see how to use a dll as well as how to create them.
 +
 
 +
silently fails if $dll(1) contains a space:
 +
<pre>//if ($dll(1)) dll -u $dll(1)</pre>
 +
works whether or not $dll(1) contains a space:
 +
<pre>//if ($dll(1)) dll -u $qt($dll(1))</pre>
 +
 
 +
if $dll(1) is $mircdir $+ subdir\foo.dll and $dll(2) is $mircdir $+ foo.dll
 +
"/dll -u foo.dll" matches the 1st index matching $nopath(foo.dll), so it removes subdir\foo.dll unless that were loaded last. But "/dll -u $qt($dll(2))" removes the foo.dll not located in the subdir.
 +
 
 +
<pre>//dll foo.dll no_such_function | echo -a test</pre>
 +
If foo.dll does not exist, the script halts with an error, and the echo does not display. If foo.dll does exist but the function does not exist, /dll displays an error to status window, but the script continues executing the echo. It also loads foo.dll even if the function doesn't exist, and remains loaded in memory if the .dll's initialization routine sets mKeep=$true. See the $dll article for keeping the .dll loaded after execution, and for keeping the .dll past 10 minutes of idle time.
 +
 
 +
While $dll(foo,function,) returns a 3rd parameter even if it's $null, "/dll foo.dll" does not require parm3.
  
Look at the [[Dynamic_Link_Library_(DLL)_-_mIRC|Dll]] To see see how to use a dll as well as how to create them
+
Using
 +
<pre>/dll file.dll function string</pre>
 +
used for loading a dll is roughly equivalent to
 +
<pre>noop $dll(file.dll,function,string)</pre>
  
 
== Compatibility ==
 
== Compatibility ==
Line 21: Line 44:
  
 
== See also ==
 
== See also ==
* [[List of commands - mIRC|List of commands]]
 
* [[List of identifiers - mIRC|List of identifiers]]
 
 
* {{mIRC|$dll}}
 
* {{mIRC|$dll}}
 
* {{mIRC|$dllcall}}
 
* {{mIRC|$dllcall}}
{{mIRC command list}}
+
* {{mIRC|sendmessage}}
 
 
[[Category:MIRC commands]]
 

Revision as of 13:46, 7 October 2019

The /dll command can be used to call an exported function from DLL with the specified parameters.

Synopsis

/dll <libName.dll> <funcName> [data]
/dll -u <libName.dll>

Switches

  • -u - Unload the given loaded library.

Note: if you pass only a filename, (for example "test.dll", instead of /folder/test.dll or c:\fullpath\test.dll), /dll -u will begin with N=1 looking into the whole list of dlls for a match between $nopath($dll(Nth)) instead of looking into $mircdir only or looking in $mircdir first.

Parameters

  • <libName.dll> - The name and path of the dynamic link library (DLL) file.
  • <funcName> - The name of the exported function to call
  • [data] - The data to pass to that function.

Note: If the path or filename contains a space, <libName.dll> MUST be enclosed in doublequotes.

Examples

Look at the dll article to see how to use a dll as well as how to create them.

silently fails if $dll(1) contains a space:

//if ($dll(1)) dll -u $dll(1)

works whether or not $dll(1) contains a space:

//if ($dll(1)) dll -u $qt($dll(1))

if $dll(1) is $mircdir $+ subdir\foo.dll and $dll(2) is $mircdir $+ foo.dll "/dll -u foo.dll" matches the 1st index matching $nopath(foo.dll), so it removes subdir\foo.dll unless that were loaded last. But "/dll -u $qt($dll(2))" removes the foo.dll not located in the subdir.

//dll foo.dll no_such_function | echo -a test

If foo.dll does not exist, the script halts with an error, and the echo does not display. If foo.dll does exist but the function does not exist, /dll displays an error to status window, but the script continues executing the echo. It also loads foo.dll even if the function doesn't exist, and remains loaded in memory if the .dll's initialization routine sets mKeep=$true. See the $dll article for keeping the .dll loaded after execution, and for keeping the .dll past 10 minutes of idle time.

While $dll(foo,function,) returns a 3rd parameter even if it's $null, "/dll foo.dll" does not require parm3.

Using

/dll file.dll function string

used for loading a dll is roughly equivalent to

noop $dll(file.dll,function,string)

Compatibility

Added: mIRC v5.6
Added on: 03 Jun 1999
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also