Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 committed Jun 24, 2024
1 parent 5a8a795 commit 2da738e
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ with [LuaJIT] FFI, but written from scratch in C language.

## Example

```c
// create a file named add.c and compile it to a dynamic lib.
// gcc -o libadd.so -fPIC -shared add.c
int add(int x, int y)
{
return x + y;
}
```
```lua
local ffi = require 'ffi'

Expand All @@ -55,8 +46,6 @@ ffi.cdef([[
int gettimeofday(struct timeval *tv, struct timezone *tz);
char *strerror(int errnum);
int add(int x, int y);
]])

local function strerror(errno)
Expand All @@ -70,9 +59,6 @@ if ffi.C.gettimeofday(tv, nil) < 0 then
else
print('tv.tv_sec:', tv.tv_sec, 'tv.tv_usec:', tv.tv_usec)
end
local mylib = ffi.load('./libadd.so')
print('add:', mylib.add(1, 2))
```

## Basic types supported
Expand Down

0 comments on commit 2da738e

Please sign in to comment.