diff options
| author | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-10-02 14:28:40 +0000 |
|---|---|---|
| committer | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-10-02 14:28:40 +0000 |
| commit | 753cc4cdfeeb2bca48b4e8a703384401109370e5 (patch) | |
| tree | bb4fe73fc9410336c0a3b0db14a4179a9100a3e2 /ext/dl | |
| parent | 45176dba6183697734bcd8cf6dae614b180428da (diff) | |
| download | ruby-753cc4cdfeeb2bca48b4e8a703384401109370e5.tar.gz ruby-753cc4cdfeeb2bca48b4e8a703384401109370e5.tar.xz ruby-753cc4cdfeeb2bca48b4e8a703384401109370e5.zip | |
Improve the description.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl')
| -rw-r--r-- | ext/dl/doc/dl.txt | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/dl/doc/dl.txt b/ext/dl/doc/dl.txt index 4557d6d30..44499bba1 100644 --- a/ext/dl/doc/dl.txt +++ b/ext/dl/doc/dl.txt @@ -47,17 +47,16 @@ 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 timeval structure. "long tv_sec", "long tv_uses", ] end - val = LIBC::Timeval.malloc # allocate the memory. + val = LIBC::Timeval.malloc # allocate memory. -The above example uses LIBC::Timeval.malloc, 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(). +Notice that the above example takes LIBC::Timeval.malloc to allocate memory, +rather than LIBC::Timeval.new. It is because DL::Timeval.new is for wrapping +an object, PtrData, which has already been created. We can define a callback using the module function "callback" as follows: |
