Sorry for the long reply!!!
DLL is a Dynamic Linked Library. very basically, It's like a plug-in for windows which can be shared by all applications requiring it, but...for Opus, DLLs are for using, rather than for creating. You don't create a DLL from Opus.
Imagine you have written something in Opus and you need to use a calculator. You could write your own, but how nice it would be if you could simply use the one that comes as standard with windows!! Having the DLL support allows you to do this type of thing directly from Opus so your program is smaller because you dont have the code to create an internal calculator.
So a DLL is like a chunk of code which does something and there are public 'functions' available for anyone to use. Another term used is API (Application Programming Interface). The two terms are generally interchangable. An API would normally comprise many DLLs and defines the larger interface to the external function.
So the most immediatly useful way of using this capability is to use the huge number of windows libraries which are supplied with it.
that's the 'easy' bit. The difficult bit is finding the information on the DLLs and actually knowing about them. Web searching is the best way of finding that. Microsoft make all their API/DLLs public, so the information is there for the finding.
However....for me, it has an even more interesting use. Every piece of hardware which plugs into a PC will come with a DLL. The DLL acts as a software interface which allows windows to drive the hardware.
I have an interface card connected to my PC and the documentation on the DLL. The card has 20 functions..
for example the DLL has the following functions:-
1 OpenDevice(long CardAddress)
2 OutputAnalogueChannel(long Channel, long Data)
3 ReadAnalogueChannel(long Channel)
these are public functions available to me
I have a script in my Opus publication and a function called OpenDevice.....
function OpenDevice(Address)
{
MyDLL=LoadDLL(SYSTEM_WINSYS_DIR+"Interface.dll")
if(MyDLL)
{
Open=MyDLL.CallFn("OpenDevice","false","slong","ulong",Address)
}
else
{
Debug.trace("DLL not loaded")
}
}
In my opus publication I have a button with the OpenDevice function attached, so when the buttion is pressed OpenDevice(0) is called....open device zero...(zero is the card address)
When the button is pressed, my Opus function is called, which in turn calls the OpenDevice function of the interface card, sending an unsigned long number for the address....and the card is opened.
I have another button called 'Channel 1 ON'
When this is pressed it makes the call to my opus function called OutputAnalogueChannel(1,255)
here is the function.........
function OutputAnalogChannel(Channel,Data)
{
MyDLL.CallFn("OutputAnalogChannel","false","none","ulong",Channel,"ulong",Data)
}
So this calls the OutputAnalogueChannel function of the external card, sending the channel number and setting...channel one is set to 255, which is maximum output, if I wanted half output I would use (1,127). For channel 2 set to max, it would be (2,255).
The third function causes the card to return a value, I am reading the value of the analogue input channel. My Opus function is
function ReadAnalogChannel(Channel)
{ ReadAChannel=MyDLL.CallFn("ReadAnalogChannel","false","ulong","ulong",Channel)
}
When I call this, the value is read from the card and put into the 'ReadAChannel' variable in my publication.
The possibilities introduced by DLL support and endless!!!!
_________________ Whoever designed this, never actually used it!
|