The Rulbus Device Library has been developed with Borland C++ 5.6.
Some reasons for this are:
There are at least two important aspects to this choice:
rulbus.lib import library is in OMF formatrulbus-coff.lib, is provided to use the library with a compiler other than Borland C++.
The Rulbus Device Library uses the cdecl calling convention. It is specified via the RDL_API preprocessor symbol in the function prototypes (rulbus.h) and definitions.
The calling convention is the arrangement of arguments for a procedure or function call. Different programming languages may require arguments to be pushed onto a stack or entered in registers in left-to-right or right-to-left order, and either the caller or the callee can be responsible for removing the arguments. The calling convention also determines if a variable number of arguments is allowed [foldoc].
Implicit linking a DLL requires an import library that is compatible with the compiler that is used to create a program. It is especially difficult to create an import library for Microsoft Visual C++ when the stdcall calling convention is used for the functions that are exported by the DLL created with Borland C++. Harold Howe's Creating DLLs in BCB that can be used from Visual C++ [BCBDEVDLL] shows how it can be done for both the cdecl and the stdcall calling convention.
The following sections show how programs can be compiled using Borland C++, Microsoft Visual C++, GNU C and LabWindows/CVI.
Here, {include-path} specifies the directory with rulbus.h and rulbus-types.h and {library-path} specifies the directory with rulbus-omf.lib or with rulbus-coff.lib.
This compiler uses OMF library format.
bcc32 -I{include-path} -L{library-path} {program}.cpp rulbus-omf.lib
With Borland C++ version 5.6 you also can create a program that can be used without the DLL (standalone program). To this end the program is statically linked with the Rulbus Device Library, the Rulbus Device Class Library and the Windows Utilities Library.
bcc32 -tWM -I(include-path) -L{library-path} {program}.cpp \
rulbus-omf-static.lib rulbusdcl-omf-static.lib winutils-omf-static.lib
Option -tWM specifies that the program must be linked with the multi-threaded C runtime library.
When you create a standalone program, you must inititialize the Rulbus Device Library yourself with rdl_initialize().
This compiler uses COFF library format.
cl -I{include-path} {program}.cpp /link -Libpath:{library-path} rulbus-coff.lib
This compiler uses COFF library format.
g++ -I{include-path} -L{library-path} -o{program} {program}.cpp -lrulbus-coff
This compiler uses OMF/COFF ?? library format.
| previous | top | next |