Personal tools
From wiki.swiftlytilting.com
Jump to: navigation, search

WinBinder Manual/wb load library

Loads a DLL into memory.

Contents

Syntax

int wb_load_library (string libname)

libname - fully qualified or raw name.

Returns

Returns an integer identifying libname. If libname is NULL then returns the identifier of the last library returned. TReturns NULL if no library was found.

Name expansion

The function appends some characters to the library name until it finds the library, then it returns an identifier for that library, or NULL if the library was not found. If libname is "LIB", for example, the function looks for the following files, in order:

  1. LIB
  2. LIB.DLL
  3. LIB32
  4. LIB32.DLL
  5. LIB.EXE
  6. LIB32.EXE

For each name, the function looks in the following locations:

  1. The application directory;
  2. The current directory;
  3. The 32-bit System directory (Usually C:\WINDOWS\SYSTEM32 or C:\WINNT\SYSTEM32);
  4. The 16-bit System directory (Usually C:\WINDOWS\SYSTEM or C:\WINNT\SYSTEM);
  5. The Windows directory (Usually C:\WINDOWS or C:\WINNT);
  6. The directory list contained in the PATH environment variable.

Example

// Returns the number of seconds elapsed since the computer started.

function get_ticks()
{
    static $KERNEL = null;
    static $GetTickCount = null;
 
    if($KERNEL === null)
        $KERNEL = wb_load_library("KERNEL");
    if($GetTickCount === null)
        $GetTickCount = wb_get_function_address("GetTickCount", $KERNEL);
    return (int)(wb_call_function($GetTickCount) / 1000);
}

See also

Winbinder Projects