In order to define external functions, you will need access to a C/C++ compiler capable of generating Windows Dynamic Link Libraries (DLLs). The use of C/C++ is not mandatory, since there are other languages with which you can generate DLLs. If you wish to use another language please be sure that the variable types supported by that language are the same as those in C, or are appropriately recast.
Exported functions should be marked to use the calling convention matching the macro definition of VEFCC (for Vensim External Function Calling Convention). On Windows this is __stdcall on other operating systems this is blank –so the default calling convention is used.
Vensim DSS ships with a sample external function library venext.c. It is highly recommended that you copy this file and modify it to add in your own functions, or at least use it as an example. The file contains sufficient internal documentation to make this a straightforward task. The documentation contained in this section provides an overview of what the external function library does, but is not sufficiently detailed to be of use as a guide to programming external functions unless you have considerable Windows programming experience.
When Vensim loads the external function library, it will first call the function version_info. This function must be exported by the DLL and should return the version number as an int.If this function does not exist, is not exported, or if it returns a value other than EXTERN_VCODE as defined in Vensim.h, the library will be unloaded and no external functions will be available. EXTERN_VCODE is currently 5840 and 5841 for double precision, but check Vensim.h to determine the correct value to use.
NOTE It is important that the exported functions be named in an export definitions (.def) file included in your project definition. The file venext.def is should be all that you need.