Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Content of a callback function – PB Docs 2022 – PowerBuilder Library

Content of a callback function – PB Docs 2022

Content of a callback function

The processing that occurs in the callback function is entirely up
to you. This section illustrates a simple way of handling it.

UserData buffer

In this example, the UserData buffer is a structure with a field
whose value points to the actual message buffer. Other fields keep track
of the message buffer’s contents as it is filled:

Calling program

In the calling program, the UserDataInfo structure is
initialized.

The calling program does not know how much room will be required
for messages, so it allocates 60000 bytes (an arbitrary size). If you
are gathering link errors, it’s probably enough. It might not be enough
if you wanted directory information for a large library:

Define function pointer

The calling program defines a function pointer to the callback
function that it passes to the ORCA function:

Call ORCA

The calling program calls the ORCA function, passing the callback
function pointer and the UserData buffer pointer. This example calls
PBORCA_ExecutableCreate, whose callback type is PBORCA_LNKPROC:

Process results

Finally, the calling program can process or display information
that the callback function stored in the UserData buffer.

Free allocated memory

If your UserData structure allocates memory, free the allocated
memory:

Callback program

The callback program receives a structure with the current error
or information and stores the information in the message buffer pointed
to by lpszBuffer in the UserData buffer. It also manages the pointers
stored in the UserData buffer.

Simple callback

A simple callback might do the following:

  • Keep count of the number of times it is called

  • Store messages and reallocate buffer if it overflows

This code implements a callback called LinkErrors for
PBORCA_ExecutableCreate:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x