Programmer's Reference

PlatformLibrary protocols

Instances of PlatformLibrary are used to look up function or data addresses in operating system shared libraries. PlatformLibrary is used implicitly by instances of PlatformFunction.

Each instance has a logical name and a physical name. The logical name is the name used to refer to the library in Smalltalk (for example, the library name used in a PlatformFunction). The physical name (which can be the same as the logical name) is the name that is passed to the operating system. The PlatformLibrary class keeps a list of all instances that it creates. This way, multiple instances with the same logical name are never created.

Instance methods: accessing

logicalName
Answers the logical name of the receiver (a String).

physicalName
Answers the physical name of the receiver (a String or nil).

Instance methods: library operations

getAddress:
Answers the address (a positive Integer) of the library object in the receiver. The library object must be a String or an Integer. If the library object cannot be found, a walkback occurs.

close
Closes the receiver. All PlatformFunctions that reside in the receiver are unbound.

Class methods: mapping logical names to physical names

mapLogicalName:toPhysicalName:
Sets the mapping for the platform library's logical name to the specified physical name. If a PlatformLibrary with the specified logical name exists, closes it and sets its physical name as indicated. If a new instance of PlatformLibrary with the logical name is created at some later time, its physical name is set as indicated. The logical name and the physical name must be a String. The physical name must be either a String or nil. If the physical name is nil, all functions in the library are looked up in the user primitive table instead of an operating system shared library.

removeMappingForLogicalName:
Removes the mapping for the logical name, if any. If a PlatformLibrary with the logical name exists, closes it, and sets its physical name to the logical name. If a new instance of PlatformLibrary with the logical name is created at some later time, its physical name is set to the logical name. The logical name must be a String.

Class methods: instance creation

logicalName:
If a PlatformLibrary with the logical name already exists, answers it. Otherwise, answers a new instance whose logical name is as indicated and whose physical name is set according to the mappings. The logical name must be a String.

Class methods: miscellaneous

removeUnreferencedLibraries
Closes all instances of PlatformLibrary. Discards any instances that are not referenced from at least one PlatformFunction. This method does not remove any mappings.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]