Generating code from automatically-generated DLLs 

You can include pre-existing, user-written or automatically-generated DLLs in the portion of the diagram from which you are generating code. To do so, you must declare the DLL functions in USERDLL.H and include the library for the DLL in VSMDLL32.BAT.

For example, to generate a DLL from a compound block in which the DLL named READ_INPUT_FILE is embedded, do the following:

      In USERDLL.H, add:

__declspec(dllexport) void _stdcall EXPORT READ_INPUT_FILE (double p[],double in [],double out[]);

This line declares the exported DLL function READ_INPUT_FILE so that automatic DLL code generation will make the proper external reference to it.

      In VSMDLL32.BAT, add:

set userlibs=READ_INPUT_FILE.LIB

This line associates the shell variable userlibs with the library file for the exported DLL function.

      To associate multiple libraries with userlibs, separate each library file with an empty space. For example:

set userlibs=READ_INPUT_FILE.LIB READ_OUTPUT_FILE.LIB

Note: If the user-written file is a CPP file, you must prefix the exported functions in the CPP file with extern “C”. For example:

extern “C”__declspec(dllexport) void _stdcall EXPORT READ_INPUT_FILE (double p[],double in [],double out[]);

This line causes the external name generated by the CPP file to be compatible Embed DLL naming conventions.