Using our DLLs with Borland C++ Builder

Last Revision Date: 4/25/2016

This article describes the steps necessary to make our DLLs compatible with Borland C++ Builder.

Our DLLs are designed to operate with the Microsoft Visual Studio environment, which by default packs structures on 8-byte boundaries. By default, Borland assumes that structures are packed on 1-byte boundaries, which requires the user to define the packing scheme manually. To do so, preface all our header (.h) files with:

#pragma pack(push)
#pragma pack(8)
...
contents of header file
...
#pragma pack(pop)

In order to link to these DLLs using Borland's C++ Builder, use the COFF to OMF C DLL import library utility provided with the Borland package.

For example, to convert the PGRFlyCapture DLL:

coff2omf.exe -lib:ms input.lib output.lib
i.e. coff2omf.exe -lib:ms PGRFlyCapture.lib PGRFCbcc.lib

You can then link the new PGRFCbcc.lib into an existing C++ Builder project.

There is an option in the C++ Builder compiler called: "Treat enum types as int". Turn on this option to avoid accidental overwriting of any user-defined buffers.

This may also resolve the issue that some Borland users have reported where flycaptureSetCameraProperty() returns FLYCAPTURE_NOT_IMPLEMENTED and enumerations, such as FlyCaptureCameraModel and FlyCaptureCameraType, are reported as NULL.

Note: There are unconfirmed instances where customers using a version of the Borland compiler prior to 6.0 have had to convert library files to the earlier COFF format before using coff2omf.exe. You can use Microsoft's linker to convert the files to the earlier COFF format:

link /lib /convert file.lib

You can then use coff2omf normally.

Related Articles