Flowdock
class
Importance_2
v1_9_3_392 - Show latest stable - 0 notes - Superclass: Object

Description

A representation of a C function

Examples

‘strcpy’

@libc = DL.dlopen "/lib/libc.so.6"
=> #<DL::Handle:0x00000001d7a8d8>
f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
=> #<Fiddle::Function:0x00000001d8ee00>
buff = "000"
=> "000"
str = f.call(buff, "123")
=> #<DL::CPtr:0x00000001d0c380 ptr=0x000000018a21b8 size=0 free=0x00000000000000>
str.to_s
=> "123"

ABI check

@libc = DL.dlopen "/lib/libc.so.6"
=> #<DL::Handle:0x00000001d7a8d8>
f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
=> #<Fiddle::Function:0x00000001d8ee00>
f.abi == Fiddle::Function::DEFAULT
=> true

Constants

STDCALL = Document-const

DEFAULT = Document-const

Attributes

[R] abi

The ABI of the Function.

Show files where this class is defined (2 files)
Register or log in to add new notes.