PBInvoke library

[ Home ]


This product is discontinued. Read more

Summary

PBInvoke is a PowerBuilder library for calling external DLL functions with arbitrary parameter and return types - structures, unions, pointers, etc. including function pointers to PowerBuilder methods callable from DLL code as callbacks.

PBInvoke goals

  • Allow PowerBuilder developers to work in PowerScript with complex data structures without writing wrapper DLLs in other languages such as C/C++.
  • Make declarations of external functions ANSI/Unicode-independent which avoids migration issues when using the same code across ANSI and Unicode versions of PowerBuilder.
  • Support any C/C++ data type (except classes). This includes complex nested data types involving structs, unions, pointers, simple types and their combinations.
  • Support not only STDCALL calling convention, but also CDECL which is default in C/C++ programs.
  • Allow PB code to be called from external functions as callbacks with full access to passed parameters.
  • Support wide range of PowerBuilder versions from PB 6 to PB 11.5 and any future version.

Why not use native PowerBuilder external functions?

PowerBuilder support of external functions has the following restrictions which make developers write wrapper code in C/C++ and compile it with third party compilers.
  • No support for PowerBuilder callbacks.
  • No support for unions and pointers to complex data types in structures.
  • External function declarations depend on string encoding expected by functions. Often a charset conversion is required between ANSI PB and Unicode DLL and vice versa. PowerScript attrubute ';ansi' is available only in PB10+ and makes the source code incompatible with older PB versions. PBInvoke automatically handles the encoding stuff (including function name suffixes such as A/W in WinAPI).

Why not use PowerBuilder extensions (PBNI)?

  • PBNI is available only as of PB9.
  • PBNI requires knowledge of C++.
  • PBNI extensions are quite hard to write and debug.
  • PBNI requires separate DLLs for ANSI and Unicode versions.

See also

  • Quick Start Guide
  • Calling DLL functions using PBInvoke
  • Handling strings (char*, wchar_t*)
  • Handling TCHAR and TSTR. Unicode/ANSI function name suffixes
  • Supported data types
  • WinAPI constants and types
  • Working with C/C++ structures/unions
  • Working with callbacks
  • Unsupported and unimplemented PBInvoke features
  • PBInvoke library license agreement
  • PBInvoke
    Home
    Download Demo
    Documentation
    Purchase
    Download Full Version

    See Also
    Quick Start Guide
    Calling DLL functions using PBInvoke
    Handling strings (char*, wchar_t*)
    Handling TCHAR and TSTR. Unicode/ANSI function name suffixes
    Supported data types
    WinAPI constants and types
    Working with C/C++ structures/unions
    Working with callbacks
    Unsupported and unimplemented PBInvoke features
    PBInvoke library license agreement


    Copyright (C) 1999 - 2024 Anatoly Moskovsky Report a site problem