Delphi
Adding uCalc to your Delphi application
In order to implement uCalc FMP in Delphi, copy uCalcDlp.pas to your project directory (or an appropriate include directory). Then place the uCalc DLL files either in the Windows System directory, your project directory, or any suitable directory that is in the path. Add the word uCalc to the list of units under the uses section of your project. Once this is done the parser will be fully ready to perform.
Demo program
The name of the uCalc demo project file to load up in Delphi is DemoDlph.dpr. The source code in the project demonstrates the essential features, especially as they relate to Delphi. The uCalc-related source code itself is found in DemoDlp.pas.
Standard Call
It is very important to always remember to use the Standard Call convention for all uCalc callbacks. For example:
function MyEasyCallback(a: Double; var b: Longint;
c: Byte): Extended; stdcall;
Data type considerations
uCalc supports various data types. The nomenclature for these types varies widely from compiler to compiler. It is important to make sure that the data types of your Delphi callbacks match the correct uCalc data types. uCalc's default String type, which is a dynamic multi-byte string type, matches Delphi's AnsiString type. Some compilers do not support the Extended precision type. uCalc is optimized for Extended precision, and Delphi supports it. So you may want to use Extended instead of Double.
New or Enhanced
ucDefineFunction('MyEasyCallback(ByVal
a As Double, ByRef b As Long)", Longword(@MyEasyCallback));
you can now simply do:
ucDefineFunction('MyEasyCallback(ByVal
a As Double, ByRef b As Long)", @MyEasyCallback);