Creating PB-specific DLLs in C

Creating PB-specific DLLs in C

Post by Gregor N. Purd » Wed, 07 Feb 1996 04:00:00



Creating a DLL in C for use by Visual Basic or PowerBuilder is not hard.

However, creating a DLL with an API specially suited to either VB or PB
is not so easy.

I have created a DLL written in C and C++ and have created a set of wrapper
functions specially suited to VB. These functions allow the VB programmer
to interact with the DLL without all the trouble normally involved in
string passing. For instance, the functions can return VB strings instead
of having a (preallocated) string buffer passed in. Also, in the case of
passing in a string buffer, the buffer does not have to be pre-allocated.

Take the example of reading a line in from a file. No one knows how long
the line could be. Choosing a fixed length buffer is unwise. However,
if we follow Microsoft's lead with the Windows API functions, the buffer
must be preallocated, and if the line is longer, then we loose information.
Also, if we preallocate a HUGE buffer and the line is small, we've just
wasted a lot of space.

Now, the utilities used to construct this VB-aware set of functions in the
DLL is called VBAPI. Is there something similar for PowerBuilder, where
a C-based DLL can receive native PowerBuilder strings and perform operations
on them (get their C-string contents, set their contents to a given C string,
etc.)?

Any pointers would be appreciated.

--Gregor N. Purdy

 
 
 

Creating PB-specific DLLs in C

Post by Mike Swa » Thu, 08 Feb 1996 04:00:00



: Now, the utilities used to construct this VB-aware set of functions in the
: DLL is called VBAPI. Is there something similar for PowerBuilder, where
: a C-based DLL can receive native PowerBuilder strings and perform operations
: on them (get their C-string contents, set their contents to a given C string,
: etc.)?

As far as I know, no such creature exists.

--

disclamer: I lie.