cffi.e
- Posted by AlexXX Feb 17, 2021
- 1138 views
I try to apply cffi. e, it seems I do everything as in the documentation examples, an error occurs: F:\phix\builtins\cffi.e:232 in procedure err() attempt to divide by 0 msg = `unknown size typedef` ... called from F:\phix\builtins\cffi.e:455 in function do_type() mtype = `typedef` machine = 32' ' substruct = 0
Ideally, I would like to make a library without using third-party libraries (arwen, win32lib)
by the way, in the example about get_struct_size error: integer size = get_struct_field(id MBP).
And I still don't understand
integer rid = define_c_func(object lib, object fname, sequence args, atom return_type)
integer rid = define_cffi_func(object lib, string cdef, integer machine=machine_bits ())
and where is the function name passed
by the way, in the example about get_struct_size error: integer size = get_struct_field(id MBP).
And I still don't understand
integer rid = define_c_func(object lib, object fname, sequence args, atom return_type)
integer rid = define_cffi_func(object lib, string cdef, integer machine=machine_bits ())
and where is the function name passed
include cffi.e constant SM_SYSTRAY = WM_USER + 5 constant tNOTIFYICONDATA=""" typedef struct _NOTIFYICONDATA { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; TCHAR szTip[128]; } NOTIFYICONDATA, *PNOTIFYICONDATA; """ set_unicode(0) constant integer idNOTIFYICONDATA = define_struct(tNOTIFYICONDATA) atom pNOTIFYICONDATA = allocate_struct(idNOTIFYICONDATA) constant SHELL32 = open_dll("shell32") -- -- constant Shell_NotifyIconA = define_cffi_func(SHELL32,tNOTIFYICONDATA) -- -- dwMessage constant NIM_ADD = 0, NIM_MODIFY = 1, NIM_DELETE = 2, NIF_MESSAGE = 1, NIF_ICON = 2, NIF_TIP = 4 -- procedure init_pNOTIFYICONDATA(atom hwnd, atom id, object flags, atom icon, object tip) integer size = get_struct_size(idNOTIFYICONDATA) set_struct_field(idNOTIFYICONDATA,pNOTIFYICONDATA,"cbSize",size) set_struct_field(idNOTIFYICONDATA,pNOTIFYICONDATA,"uFlags",flags) set_struct_field(idNOTIFYICONDATA,pNOTIFYICONDATA,"uCallbackMessage",SM_SYSTRAY) end procedure