diff options
| author | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-14 15:21:23 +0000 |
|---|---|---|
| committer | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-14 15:21:23 +0000 |
| commit | 5262888d4505ec37be1d419f77c18f95a6da1151 (patch) | |
| tree | a054a1c64ae38277decabd7e334dc2bd19074ef1 /ext/dl | |
| parent | 15a320a17acbba99adf7ba462b7344e4af85adf3 (diff) | |
| download | ruby-5262888d4505ec37be1d419f77c18f95a6da1151.tar.gz ruby-5262888d4505ec37be1d419f77c18f95a6da1151.tar.xz ruby-5262888d4505ec37be1d419f77c18f95a6da1151.zip | |
Edit the documentation.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl')
| -rw-r--r-- | ext/dl/doc/dl.txt | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/dl/doc/dl.txt b/ext/dl/doc/dl.txt index 88c8b2d77..c71de5179 100644 --- a/ext/dl/doc/dl.txt +++ b/ext/dl/doc/dl.txt @@ -47,12 +47,17 @@ struct and union which are defined in dl/struct.rb as follows: require "dl/struct" module LIBC extend DL::Importable - Timeval = struct [ # define the timeval structure. + Timeval = struct [ # define the timeval structure. "long tv_sec", "long tv_uses", ] end - val = LIBC::Timeval.new # allocate the memory. + val = LIBC::Timeval.alloc # allocate the memory. + +The above example uses LIBC::Timeval.alloc, since we use LIBC::Timeval.new(ptr) +to wrap the given PtrData object which is, for example, created by DL::malloc(). +DL::malloc() is a function to allocate a memory by using the C library function +malloc(). DL::Importable module is very useful. However, we sometimes encounter a case that we must directly use low-level functions such as dlsym(). In such case, |
