Block level functions

To interface smoothly with Embed, Embed can call eight Pascal-style functions that share the base DLL function name and have an event code suffix corresponding to an Embed event. You should supply a function for each event that you want your DLL code to handle. The additional functions are described below:

Function name

Purpose

When it’s called

userBlock()

Block time step

Each simulation time step

userBlockEvent()

Block event handler

On occurrence of a block-related event

userBlockPA()

Block parameter allocation

Block creation

userBlockPC()

Block parameter change

Right button click

userBlockPI()

Block parameter initialization

Immediately after userBlockPA()

userBlockSE()

Block simulation end

Simulation end time

userBlock SS()

Block simulation start

Simulation start time

userBlockWF()

Block window painting

All stages of block window lifecycle

 

The term userBlock is a placeholder for your DLL base function name. You specify the DLL base function name when you bind the DLL to a userFunction block. For more information, see Accessing a custom block from Embed.  

You can have any number of user-written blocks in a single DLL file.

All definitions are kept in the VSUSER.H file. This file should be included in every user DLL.