devxlogo

Passing a parameter to an external function

Passing a parameter to an external function

Question:
Can I pass the address of a PowerBuilder function as an argument to an external function located in a dll? The dll documentation shows that it expects the address of an error function of the form “void my_function(void *ptr)” as a parameter.

Answer:
You cannot do this directly in PowerBuilder.

The way around it is to write a C wrapper for the API call, and then make your call to your wrapper DLL in PowerBuilder. The wrapper then calls the API passing the function pointer to itself. Then you can use the C wrapper to pass back any errors or notifications to PowerBuilder.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist