Making U Function DLL

 

This chapter explains making a DLL file of U Function in Visual studio 2005 environment.

 

Include File

There is uFunction.h as an included file in <Install Dir>\Toolkits\U_Function\extern\include and it must be needed when you create a DLL file. A class called CSys is defined in the function of uFunction.h. It is the imported class based on the type like __declspec(dllimport) and it is used when you create each function in U Function. The uFunction.h file can be available to Windows 32 bit and Windows 64bit.

 

Library Files

There is CoLinkSolver_x64.lib in the installed folder. (<Install Dir>\Toolkits\U_Function\extern\lib.) They are the library files which have the information of opened CSys class. When DLL is linked, you should add the library files.

 

Exported Functions

The below functions are exported as "C" __declspec(dllexport) type in source code.

 

     void simInitializes( CSys *CS )

     void simInitialConditions( CSys *CS )

     void simUpdateParameters( CSys *CS )

     void simJacobians( CSys *CS )

     void simDerivatives( CSys *CS )

     void simOutputs( CSys *CS )

     void simTerminates( CSys *CS )

 

Building Dll

If you use the U Function sample solution file which is made in Visual studio 2005 in the installed folder (<Install Dir>\Help\U_Function\UFunction_Sample), you can easily use U Function. Also, if you want to create a new project in Visual Studio 2005, you should build it after checking the following information.

 

1.  Define Project Configuration Type as Dynamic Library(.dll)

 

Figure 1  UFunction_Sample property Pages dialog box

 

2.  Copy the header file and library file to the location which is included the cpp file.

 

     Location of Original File

    <Install Dir>\Toolkits\U_Function\extern\include

    <Install Dir>\Toolkits\U_Function\extern\lib

 

Figure 2  Copying the Header File and Library File

 

3.  Add the uFunction.h file to Head Files.

 

Figure 3  Adding the uFunction.h file

 

4.  Enter the following information in Additional Dependencies of Linear.

 

     If Windows is 64bit, enter CoLinkSolver_X64.lib.

 

Figure 4  Setting the Additional Dependencies

 

Note

If you use the U Function solution file which is made in Visual studio 2005 in the installed folder (<Install Dir>\Help\U_Function\UFunction_Sample), you can easily use U Function.