[swift-users] module (de)-initialization
Joe Groff
jgroff at apple.com
Wed Dec 21 12:06:21 CST 2016
> On Dec 20, 2016, at 8:54 AM, Jens Alfke via swift-users <swift-users at swift.org> wrote:
>
> Also, AFAIK there is no mechanism in Swift (yet) to load or unload a module at runtime, so a module load occurs when the program starts up, and an unload occurs when the program exits.
dlopen works fine, though the only supported ways of getting a callable symbol out of the loaded image are currently to use a C entry point or look up a type defined in the module by name. Unloading Swift modules will likely never be supported, since this would impose a ton of complexity and performance cost on the runtime for little benefit. (Apple's ObjC runtime does not support unloading dylibs after classes inside them have been reified either.)
-Joe
More information about the swift-users
mailing list