Skip to content

How to create an External Library Function

If we take Visual 'C' as the development tool to create an ELF function, the skeleton should be:

VARIANT __declspec(dllexport) FunctionName(VARIANT param1, VARIANT param2)
{
    CComVariant vResult;
    // Some code to process param1 and param2 into vResult
    return vResult;
}

DataFlex Reports uses the standard calling convention (_stdcall). Make sure that the DLL uses this convention. ELF functions must use parameters passed as type VARIANT.

To explain building an ELF function numberToWords, follow the next walkthrough which uses 'C' and assumes you understand the fundamentals of the 'C' language and Microsoft Visual Studio.

Steps

  1. Creating a new dynamic link library (DLL) project
  2. Adding functions to the dynamic link library
  3. Creating an ELF reference in DataFlex Reports Studio that references the dynamic link library
  4. Using the functionality in a report

In addition to the above article, How to use Windows API functions in DataFlex Reports explains how to extend the ELF further.

A variant of the NumberToWords function could be a CurrencyToWords function. Click here for the 'C' code.