Next Previous Contents

## 3.101 mod_load

> Function

>   Load a relocatable module.

> Header

>   `modload.h`

> Declaration

>   `unsigned char mod_load (struct mod_ctrl* ctrl);`

> Description

>   The function will load a code module into memory and relocate it. The function will return an error code. If `MLOAD_OK` is returned, the outgoing fields in the passed `mod_ctrl` struct contain information about the module just loaded. Possible error codes are:

>   - `MLOAD_OK` - Module load successful
>   - `MLOAD_ERR_READ` - Read error
>   - `MLOAD_ERR_HDR` - Header error
>   - `MLOAD_ERR_OS` - Wrong operating system
>   - `MLOAD_ERR_FMT` - Data format error
>   - `MLOAD_ERR_MEM` - Not enough memory
> Limits

>   - The ld65 linker is needed to create relocatable o65 modules for use with this function.
> Availability

>   cc65

> See also

>   mod_free

> Example

>   None.

Next Previous Contents