www.delorie.com/gnu/docs/smalltalk/gst_18.html   search  
Buy GNU books!

GNU Smalltalk User's Guide

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.6 Dynamic loading

The DLD class enhances the C callout mechanism to automatically look for unresolved functions in a series of program-specified libraries. To add a library to the list, evaluate code like the following:
     DLD addLibrary: '/usr/lib/libc'

The extension (`.so', `.sl', `.a', `.dll' depending on your operating system) will be added automatically. You are advised not to specify it for portability reasons.

You will then be able to use #defineCFunc:... (see section 3.2 Using the C callout mechanism) to define all the functions in the C run-time library. Note that this is a potential security problem (especially if your program is SUID root under Unix), so you might want to disable dynamic loading when using GNU Smalltalk as an extension language. To disable dynamic loading, configure GNU Smalltalk passing the `--without-dld' switch.

Note that a DLD class will be present even if dynamic loading is disabled (either because your system is not supported, or by the `--without-dld' configure switch) but any attempt to perform dynamic linking will result in an error.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003