Difference between revisions of "DLL Support"
(Created page with "==DLLs included with Flowcode== A DLL or Dynamic Link Library is a common way of wrapping a set of software functions up into a library that can be called by an application....") |
|||
(20 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | <sidebar>Sidebar: Flowcode Help Overview:Simulation</sidebar> | ||
==DLLs included with Flowcode== | ==DLLs included with Flowcode== | ||
Line 9: | Line 10: | ||
Collect the system time and date - [[Component:_Injector_(GPS_NMEA)_(Simulation)|GPS NMEA Data Injector Component]] | Collect the system time and date - [[Component:_Injector_(GPS_NMEA)_(Simulation)|GPS NMEA Data Injector Component]] | ||
− | + | Synthesize speech - [[Component:_Speech_(Outputs:_General)|Speech Component]] | |
− | |||
− | |||
− | |||
− | Synthesize speech - [[Component:_Speech_(Outputs)|Speech Component]] | ||
− | |||
Communicate over USB - [[Component:_USB_Serial_(Comms)|USB Serial]], [[Component:_USB_Slave_(Comms)|USB Slave]], [[Component:_USB_HID_(Comms)|USB HID]] | Communicate over USB - [[Component:_USB_Serial_(Comms)|USB Serial]], [[Component:_USB_Slave_(Comms)|USB Slave]], [[Component:_USB_HID_(Comms)|USB HID]] | ||
+ | Communicate over MIDI - [[Component:_MIDI_(Comms)|Midi Component]] | ||
− | Communicate over | + | Communicate over a COM port - [[Component:_COM_Port_(Advanced)|COM Port Component]] |
+ | Communicate over a network - [[Component:_TCP_Base_(Comms)|TCPIP Base Component]] | ||
Talk to existing third party hardware - [[Component:_K8055D_(Simulation)|Vellemann KS0108]], [[Component:_PS2000_(Simulation)|Pico Scope 2000 series]], [[Component:_MIAC_USB_Slave_(MIAC_Module)|MIAC USB Slave]] | Talk to existing third party hardware - [[Component:_K8055D_(Simulation)|Vellemann KS0108]], [[Component:_PS2000_(Simulation)|Pico Scope 2000 series]], [[Component:_MIAC_USB_Slave_(MIAC_Module)|MIAC USB Slave]] | ||
− | |||
− | |||
==Adding your own DLL calls into Flowcode== | ==Adding your own DLL calls into Flowcode== | ||
Line 39: | Line 35: | ||
The syntax looks like this - (DLL Function Name) : (DLL Type) [(Path to DLL)] | The syntax looks like this - (DLL Function Name) : (DLL Type) [(Path to DLL)] | ||
− | Example | + | |
+ | Example: | ||
+ | |||
+ | '''ReadTime:DLLs[$(appdir)components/dll/DateTime.dll]''' | ||
Line 46: | Line 45: | ||
DLL Type is the type of DLL, there is "DLLs" which is a standard type DLL and "DLLc" which is an alternative custom style DLL. | DLL Type is the type of DLL, there is "DLLs" which is a standard type DLL and "DLLc" which is an alternative custom style DLL. | ||
− | Path to DLL is the file path on your system, | + | Path to DLL is the file path on your system, [$(appdir)components/dll/DLLNAME.dll] can be used for the Components/DLL directory [$(srcdir)DLLNAME.dll] can be used for the project directory. |
+ | |||
+ | If you don't already know the explicit DLL function names then they can be found by using a tool like [http://www.nirsoft.net/utils/dll_export_viewer.html DLL Export Viewer] to see inside the DLL file. | ||
Line 57: | Line 58: | ||
− | The DLL based macro can then be called as part of your program just like any other macro or component macro. The DLL call can even be wrapped up inside a component macro call as part of the component export process. | + | The DLL based macro can then be called as part of your program just like any other macro or component macro. |
+ | |||
+ | The DLL call can even be wrapped up inside a component macro call as part of the component export process using the [[Interface_Manager#Interface_Manager|Interface manager]]. By specifying the macro as a simulation macro a user using your exported component can easily see that this is a macro that cannot be downloaded to an embedded target. | ||
[[File:DLLFunc.jpg]] | [[File:DLLFunc.jpg]] | ||
+ | |||
+ | ==Creating your own DLLs== | ||
+ | |||
+ | You can create your own DLLs to suit your requirements by using free to use applications such as Microsoft Visual Studio. | ||
+ | |||
+ | A guide on creating a DLL in visual studio can be found here: [[Create a dll]]<br> | ||
+ | Or a more generic example (resulting DLL is not directly compatible): [http://msdn.microsoft.com/en-us/library/ms235636.aspx Walkthrough: Creating and Using a Dynamic Link Library (C++)] |
Latest revision as of 11:08, 22 June 2015
<sidebar>Sidebar: Flowcode Help Overview:Simulation</sidebar>
DLLs included with Flowcode
A DLL or Dynamic Link Library is a common way of wrapping a set of software functions up into a library that can be called by an application. They are usually created to allow programs to do certain tasks without having to rewrite the task and re-compile the code each time. In Windows there are DLL calls to allow you to create and control application windows, play and record audio as well as a whole host of other things.
Some of the components that are packaged with Flowcode already come with their own DLL files built in to allow the components to do things like this:
Collect the system time and date - GPS NMEA Data Injector Component
Synthesize speech - Speech Component
Communicate over USB - USB Serial, USB Slave, USB HID
Communicate over MIDI - Midi Component
Communicate over a COM port - COM Port Component
Communicate over a network - TCPIP Base Component
Talk to existing third party hardware - Vellemann KS0108, Pico Scope 2000 series, MIAC USB Slave
Adding your own DLL calls into Flowcode
A DLL can easily be added to your program using the standard macro interface.
Start by placing the DLL file into a known location on your computer. A good place for stable DLL files is inside the "Flowcode v6/Components/DLL" folder or in the same folder as the Flowcode project file for portability.
The syntax looks like this - (DLL Function Name) : (DLL Type) [(Path to DLL)]
Example:
ReadTime:DLLs[$(appdir)components/dll/DateTime.dll]
DLL Function name is the name of the function in the DLL you are trying to call, if the call cannot be found then the component debugger window will display the error.
DLL Type is the type of DLL, there is "DLLs" which is a standard type DLL and "DLLc" which is an alternative custom style DLL.
Path to DLL is the file path on your system, [$(appdir)components/dll/DLLNAME.dll] can be used for the Components/DLL directory [$(srcdir)DLLNAME.dll] can be used for the project directory.
If you don't already know the explicit DLL function names then they can be found by using a tool like DLL Export Viewer to see inside the DLL file.
The DLL based macro appears like this in the Project explorer pane.
The DLL based macro can then be called as part of your program just like any other macro or component macro.
The DLL call can even be wrapped up inside a component macro call as part of the component export process using the Interface manager. By specifying the macro as a simulation macro a user using your exported component can easily see that this is a macro that cannot be downloaded to an embedded target.
Creating your own DLLs
You can create your own DLLs to suit your requirements by using free to use applications such as Microsoft Visual Studio.
A guide on creating a DLL in visual studio can be found here: Create a dll
Or a more generic example (resulting DLL is not directly compatible): Walkthrough: Creating and Using a Dynamic Link Library (C++)