C++

 

Adding uCalc to your C++ application

 

uCalc FMP includes direct support for Visual C++, and Borland C++ Builder.  To implement uCalc FMP with C++, copy uCalcCPP.h and uCalcCPP.cpp to your project directory, or an appropriate include directory.  Place the uCalc DLL files either in the Windows directory, your application directory, or an appropriate directory in the path.  Then in your application code, place the following line with the other include statements at the beginning:

 

#include "uCalcCPP.cpp"

 

 

Demo program

 

Separate form-based demos are included for Visual C++, and for Borland C++ Builder.  The source code in these files demonstrates the essential features, especially as they relate to C++.  The demo project file for Visual C++ is named DemoVC.dsw.  For Borland C++ Builder, it's DemoBCB.dpr.

 

 

Data type considerations

 

There are differences between some of Borland C++ Builder's data types and Visual C++'s equivalent types that are supported by uCalc.

   String

uCalc's default String type is a dynamic multi-byte string.  This corresponds to Borland C++ Builder's AnsiString, and Visual C++'s CString.  One uCalc string type that works the same in both editions of C++ is LPCSTR.  Your callbacks can receive LPCSTR arguments as char*.  See the demo files for implementation details.

 

   long double

In Visual C++, long double is synonymous with double, which corresponds to uCalc's Double type.  However, in Borland C++ Builder, long double is not the same as double.  C++ Builder's long double type corresponds with uCalc's Extended type.

 

 

Standard Call convention

 

It is very important to remember to always use the _stdcalll directive in your callback functions.  Or, you may configure StdCall as the default setting for your compiler.

 

ucDefine with thread handle

 

Routines such as ucDefine are implemented slightly differently from compiler to compiler.  In C++, if you want to use the thread handle, and want the first argument to be a default value of 0, you'd have to make it a DWORD 0, as opposed to an address pointer, like in this example:

 

ucDefine("Syntax: && ::= AndAlso", (DWORD)0, 0, 0, tHandle);

 

 

New or Enhanced

 

Issues for users migrating from version 2.0