Altova MapForce 2023 Professional Edition

Reference C#, C++ and Java Libraries Manually

Home Prev Top Next

This section explains how to reference custom libraries in a .mff file (MapForce Function File). The .mff file containing the reference can then be imported as a MapForce library. A .mff file is an XML file in which you manually define the link between class definitions in your custom code and MapForce. Once you create a custom .mff file, you can import it into MapForce, which is similar to importing a .NET DLL or Java class file.

 

Important:

 

If you want to use custom .NET functions in the built-in output preview (in the Output pane), these functions need to be compiled for .NET Framework 4.x or .NET Standard 2.0.

 

You can import a function into MapForce only if its return type and parameters are of simple type. To find out more about 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 (in the Output pane) is limited. For libraries written in C++, the preview of the mapping in MapForce is not supported. For Java and C#, the preview is available when your library uses native language types, but it is not available if your library imports the Altova generated classes. However, 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 need to cache calculated results for reuse or evaluate expressions in any order. Therefore, it is 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; they cannot and need not be saved to a .mff file, because they are saved together with the .mfd file in which they are created. For more information, see Call and Import UDFs.

 

If you are upgrading from a MapForce version earlier than 2010, you may need to update the data types used in your custom functions. For details, see Data Type Mapping.

 

To find out more about how to create and configure a custom .mff file, see Configure .mff File. The examples are provided in the following topics:

 

Reference C# in .mff

Reference C++ in .mff

Reference Java in .mff

 

© 2016-2022 Altova GmbH