Skip to content
Justin Schwartz edited this page Jun 27, 2020 · 4 revisions

use

  • ACE Directive*

Requests a certain interface to be used if registered, or a certain interface implementation (dependency), and creates a pointer to the interface.

If the interface is not available, the module will continue loading/attaching as normal, and the pointer will be null.

For interfaces that must be available, use the $#require directive instead.

Valid Syntax

  • $#use scope interfaceType
  • $#use scope interfaceType pointerName
  • $#use scope interfaceType pointerName// //interfaceIdOrName
  • $#use scope interfaceType pointerName// //interfaceIdOrName// //interfaceName

Parameters

scope

global or arena.

with global, requests the interface registered for ALLARENAS, and stores the pointer as a global.

for arena, requests the interface on attach registered to the arena, and stores the pointer in per-arena-data access with ($usearenadata())

interfaceType

the struct name of the interface. (for example Ichat)

pointerName

(Optional)

the variable name to use for the pointer to the interface. by default, is foo for a type named Ifoo, or _bar for any other type named bar.

interfaceIdOrName

(Optional)

the interface identifier or implementation name. (for example I_CHAT).

by default, is derived from the interface type. I_FOO is assumed for types of the form Ifoo, and I_BAR is assumed for any other types of the form bar. expects identifiers to be in the form I_FOO, otherwise it will assume this is an implementation name.

interfaceName

(Optional)

the requested implementation name. this is only for advanced uses of interfaces.

if interfaceIdOrName is a name, using this parameter is not allowed.

Clone this wiki locally