User Guide
DLL Component
The DLL
Now that we've looked at the component let's turn our attentions to the dll. As you've seen, the DLL component calls a particular function in
your dll. This function must have a very specific declaration which goes as follows:
extern "C" __declspec(dllexport) void myFunction( int nParams, int* pIn, int* pOut )
nParams tells you how many parameters are being passed. This is equal to the number of inputs you created on the DLL component.
pIn is an array which contains the input values that have been passed to the component. The contents of each entry depend on the
connector type.
pOut is an array which you use to pass values back to the component. Each entry maps onto an output on the component. You manage the
contents of this array but the array itself is created for you by FlowBotics Studio.
The pOut array is filled with zeros to start with (each entry is set to zero). The only exception to this is if the type is Ruby Frame in which
case the output entry points to the same value as the input entry.
We'll talk about data types next and have a look at how you access the information passed to you from the DLL component. We'll also look at
how you pass data back to the DLL component using the pOut array.
Data Types
The pIn and pOut arrays are declared as int* but each entry is not necessarily an int. The value changes depending on the data type and to
get at this data you may need to do some C casting. More on that in a moment.
First we'll look at the various FlowBotics Studio types and how they are represented in C when they arrive at your dll. We've seen in the last
section that the DLL component allows you to use 9 different data types. These are represented in C as shown in the table below.
FlowBotics Studio Type C Representation
Int
int
Float
float
Boolean
The first byte of the entry is a bool
String
char* an array of chars which is zero terminated
Float Array
float[n+1] where n is the number of array entries and the first 4 bytes is an int giving you the
number of entries
Int Array
int[n+1] where n is the number of array entries and the first 4 bytes is an int giving you the number
of entries
String Array
char*[n+1] where n is the number of array entries and the first 4 bytes is an int giving you the
number of entries
Bitmap
unsigned char[n+12] where n = width x height x channels. The first 4 bytes give you the width, the
next 4 bytes give you the height and the next 4 bytes give you the number of channels (all as ints).
Frame
float[n+1] where n is the number of array entries and the first 4 bytes is an int giving you the
number of entries. This is the same as for a Float Array
Let's take a look at each type in more detail.
187 of 212