# Locating a DLL

A polymorphic DLL is loaded by calling one of the `Load()` member functions of an `RLibrary` object.

`Load()` has three overloaded variants but they all behave in a similar way. They are prototyped:

```TInt Load(const TDesC& aFileName,const TDesC& aPath,const TUidType& aType);
TInt Load(const TDesC& aFileName,const TUidType& aType);
TInt Load(const TDesC& aFileName,const TDesC& aPath=KNullDesC);```

The arguments determine how the DLL is to be found. The rules are summarised as follows:

• If `aFileName` is a fully defined filename, i.e. it includes a path specification, then the contents of `aPath` are ignored and an attempt is made to load `aFileName`, if specified; if this DLL cannot be found, then the load operation fails and no further searching is done.

• if `aFileName` does not have an extension, an extension of `.DLL` is assumed.

• If `aFileName` contains a file name but does not include a path specification (e.g. `EULIBDR1.DLL`), then a search is done in the following locations in the order given:

• the path defined in `aPath`, if specified

• the system path `\sys\bin\` on each attached drive. Drives are searched in the order: `C:` (the device's main internal drive), then `Y:`, `X:`, `W:`, `V:`, `U:`, ..., `D:`, `B:`, `A:` and finally, drive `Z:` (the ROM).

• If `aType` is specified, then the UIDType of the loaded DLL must match `aType`. If `aType` is `KNullUid`, or the variant of `Load()` that does not take `aType` is called, then the loaded DLL will have the name `aFileName` and may have any UIDType.

Note that in WINS debug mode, the system path is `\epoc32\release\wins\udeb\` on the current PC drive; in WINS release mode, the system path is `\epoc32\release\wins\urel\` on the current PC drive. For WINSCW, the paths are the same as for WINS, except that `wins\` becomes `winscw\`.

Note also that, in contrast with the usual convention, `aPath` specifies a list of directories, each one separated by a semicolon.