Referencing Java, C# and C++ Libraries Manually

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Functions >

Referencing Java, C# and C++ Libraries Manually

As an alternative approach to importing custom libraries into MapForce directly, you can create references to them using a custom .mff file (MapForce Function File) recognized by MapForce. The .mff library file is essentially an XML file where you manually define the linking between class definitions in your custom code and MapForce. Once you create the custom .mff file, you can import it into MapForce, similar to how you would import a .NET DLL or Java class file.

 

Notes:

 

For an imported function to appear in the Libraries window, its return type and parameters must be of a simple type. For a list of data types available for each language, see Data Type Mapping.
When you import function libraries from custom .mff files, the preview of the mapping directly in MapForce (by clicking the Output button) is limited. For libraries written in C++, preview of the mapping in MapForce is not supported. In case of Java and C#, preview is available when your library uses native language types, but it is not available if your library imports the Altova generated classes. Note, however, that you can generate code in the specific language targeted by your library. The custom functions will be available in the generated code, enabling you to run the mapping from the generated code.
The exact order in which functions are called by the generated mapping code is undefined. MapForce may cache calculated results for reuse, or evaluate expressions in any order. It is therefore strongly recommended to use only custom functions that have no side effects.
It is important to distinguish between user-defined functions and custom function libraries. User-defined functions are created graphically in a mapping, and they cannot and need not be saved to an *.mff file, because they are saved together with the mapping .mfd file where they have been created. For more information, see Calling and Importing User-Defined Functions.
If you are upgrading from a MapForce version earlier than 2010, you may need to update the data types used in your custom functions (see Data Type Mapping).

 

For instructions on how to create and configure a custom .mff file, see Configuring the .mff File. For examples, see:

 

Example: Create a Custom C# Library
Example: Create a Custom C++ Library
Example: Create a Custom Java Library

© 2019 Altova GmbH