Definition: |
include cffi.e integer id = define_cffi_proc(object lib, string cdef, integer machine=machine_bits()) (note: this is a text-based wrapper of define_c_proc) |
Description: | parse a string containing a C void function definition and obtain a routine id. |
Comments: |
Converts a textual C void function definition, such as one copied directly from MSDN, to the parameters expected by define_c_proc(),
and returns the routine_id obtained by calling that function. In other words define_cffi_proc("... HWND ...") is equivalent to, and in fact maps to
define_c_proc(...{.. C_PTR ..}...) , with most of the previously manual conversion automated for you.a proc is expected to begin with a "void" return type. lib can be a string or the previous result of open_dll. The machine parameter can be set to 32 or 64, for testing purposes. |
Example: |
include cffi.e constant tSleep=""" VOID WINAPI Sleep( _In_ DWORD dwMilliseconds ); """ constant xSleep = define_cffi_proc("kernel32.dll",tSleep) c_proc(xSleep,{500}) set_unicode() is needed before any auto "A/W" handling. |
See Also: | define_c_proc, c_proc, set_unicode |
