External (DLL) Elements

In some situations, you may wish to define a complex function which can not be readily implemented using the expression editing features supplied by GoldSim. For example, calculation of an output may require very complex logic which would be cumbersome to represent using a Selector A function element that allows you to represent complex nested if, then logic. element, or it may require a numerical solution technique (e.g., iteration).

GoldSim provides two separate ways to deal with such situations:

In general, using Script elements is preferred, as this approach has the key advantages that 1) it does not require use of a separate programming language and interface; and 2) it is much more transparent (all of the "code" can be seen directly in GoldSim). However, in some cases (e.g., linking complex existing programs directly into GoldSim), Script elements cannot be used and External (DLL) elements are the only option.

The modules are linked into GoldSim as DLLs (Dynamic Link Libraries) at run time. Integrating these external modules into GoldSim requires that you develop a "wrapper" (or "shell") around your existing function, and compile it into a DLL. In most cases, this will require only a limited number of programming modifications. GoldSim supports both 32-bit and 64-bit DLLs.

An example model which uses an External (DLL) element (External.gsm) can be found in the General Examples/External folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu). This folder also includes the corresponding DLL, as well as the source code (in C++ and Fortran) for the example.