thank you!!
hans
Announcement
Collapse
No announcement yet.
function pointer translation - help needed
Collapse
X
-
Guest replied
-
None that does a good job. It is very difficult because C uses many typedefs, macros and weird syntaxes.
Your account has been approved. Sorry for the delay.
Leave a comment:
-
Guest repliedthank you.
yes i think i need to use it as pointers. is there any tool that will translate, for example the firebird headers, atleast semi automatic? this is a lot of work for somebody new that is to PB.
btw, i applied for you board.
thanks again
hans
Leave a comment:
-
If you have to use the pointers in the BLOBCALLBACK structure to call a function, then you can do it this way.
Declare a prototype for the function, e.g.
Code:' ISC_LONG blob_number_segments; DECLARE FUNCTION blob_number_segments() AS LONG
Code:DIM nSegments AS LONG CALL DWORD <name of the udt dimed AS BLOBCALLBACK>.fn_blob_number_segments USING blob_number_segments TO nSegments
Last edited by José Roca; 2 Dec 2008, 12:45 PM.
Leave a comment:
-
Guest repliedthank you very much for your help and advice!
hans
Leave a comment:
-
Code:FUNCTION isc_callback() AS DWORD END FUNCTION FUNCTION isc_resv_handle() AS LONG END FUNCTION FUNCTION ISC_PRINT_CALLBACK(BYVAL p1 AS DWORD, BYVAL p2 AS INTEGER, BYREF p3 AS ASCIIZ) AS DWORD END FUNCTION FUNCTION ISC_VERSION_CALLBACK(BYVAL p1 AS DWORD, BYREF p2 AS ASCIIZ) AS DWORD END FUNCTION FUNCTION ISC_EVENT_CALLBACK(BYVAL p1 AS DWORD, BYVAL p2 AS WORD, BYREF p3 AS ASCIIZ) AS DWORD END FUNCTION DECLARE FUNCTION isc_print_blr LIB "<name of the dll>" ALIAS "isc_print_blr" ( _ BYREF p1 AS ASCIIZ, BYVAL p2 AS DWORD, BYVAL p3 AS DWORD, BYVAL p4 AS WORD) AS LONG TYPE BLOBCALLBACK fn_blob_get_segment AS DWORD fn_blob_handle AS DWORD fn_blob_number_segments AS DWORD fn_blob_max_segment AS DWORD fn_blob_total_length AS DWORD fn_blob_put_segment AS DWORD fn_blob_lseek AS DWORD END TYPE
Last edited by José Roca; 2 Dec 2008, 10:41 AM.
Leave a comment:
-
function pointer translation - help needed
hi,
i tried to search for this translation problem, but couldn’t find anything.
maybe some one can tell me how the following code is translated to powerbasic.
i would need to know, how the function pointers are handled in powerbasic
in a translated structure and in a translated function call.
btw, is there a tool that will translate C headers to powerbasic include files?
thank you for any help
hans
typedef signed short ISC_SHORT;
typedef unsigned short ISC_USHORT;
typedef unsigned char ISC_UCHAR;
typedef char ISC_SCHAR;
typedef signed long ISC_LONG;
typedef unsigned long ISC_ULONG;
typedef void (* isc_callback) ();
typedef ISC_LONG isc_resv_handle;
typedef void (*ISC_PRINT_CALLBACK) (void*, ISC_SHORT, const char*);
typedef void (*ISC_VERSION_CALLBACK)(void*, const char*);
typedef void (*ISC_EVENT_CALLBACK) (void*, ISC_USHORT, const ISC_UCHAR*);
ISC_STATUS ISC_EXPORT isc_print_blr(const ISC_SCHAR*,typedef struct blobcallback {ISC_PRINT_CALLBACK,
void*,
short);
short (*blob_get_segment) (void* hnd, ISC_UCHAR* buffer, ISC_USHORT buf_size, ISC_USHORT* result_len);} *BLOBCALLBACK;
void* blob_handle;
ISC_LONG blob_number_segments;
ISC_LONG blob_max_segment;
ISC_LONG blob_total_length;
void (*blob_put_segment)(void* hnd, const ISC_UCHAR* buffer, ISC_USHORT buf_size);
ISC_LONG (*blob_lseek)(void* hnd, ISC_USHORT mode, ISC_LONG offset);
Tags: None
Leave a comment: