# dlldynamic

Navigation:  Language Reference > Functions > External >

# dlldynamic

## Syntax

Y = dlldynamic(filename,functionname,X);

## Description

Given a function (functionname) of a dll (filename), the dll function returns the output values (X) for a given input (Y).

Users can write their own source code using a native compiler such as Visual C++ or Borland C++. With these compilers it is possible to create DLL’s with user defined functions that have an input- output relation which can be embedded in simulation code.

## Examples

parameters

string dllName = 'demoDynamicDll.dll';

string functionName = 'SFunctionCalculate';

variables

real x[2],y[2];

equations

x = [ramp(1);ramp(2)];

y = dlldynamic(dllName,functionName,x);

## Limitations

The filename and functionname must be string parameters. Note that the size of Y and X (scalars or matrices) must correspond with the size that is expected for the given dll-function.

## Search Order

20-sim uses the following search order for the dll-file:

 1 The bin directory of 20-sim (usually C:\Program Files\20-sim 4.7\bin).
 2 The current directory.
 3 The Windows system directory.
 4 The Windows directory.
 5 The directories that are listed in the PATH environment variable.

The simplest place to put the dlldynamic-file is the bin directory, but it is always possible to give a complete path for the dll filename.