Using a DLL library

Hello,
I am interested in how to use a DLL library. It is a communication library to the device. DLL library was added to the device.
Thank you.

Look for the Declare statement in the documentation.
There are several examples on how to use it.

Thanks for the reply. I successfully did.
I have another question, how to define a DLL that will be accessible everywhere.
Example:
Currently defined as follows in the Open event:

Dim  device As New PoKeysDevice_DLL.PoKeysDevice

If you want to re-use the DLL functions need to redefine in any other event.

Is there a possibility and how to define the DLL as a global function?

You can create your own global function that wraps the DLL call, of course.

Alternatively, you can add an “External Method” to a module or class.

Hypothetically would it be possible to have a program read the dll file or use introspection on it to generate RealStudio classes that implement the entire dll?

DLL’s are fairly well defined
You could write something that opens them & reads all the exports they have & writes out a Xojo class that interfaces to that DLL
See dlopen & the related calls on OS X Linux
Windows you need to look at LoadLibrary (I think thats the right call)

Thanks for the replies.
Can anyone provide an example?

[quote=51190:@Norman Palardy]DLL’s are fairly well defined
You could write something that opens them & reads all the exports they have & writes out a Xojo class that interfaces to that DLL
See dlopen & the related calls on OS X Linux
Windows you need to look at LoadLibrary (I think thats the right call)[/quote]

Does anything like this currently exist? Anyone interested in developing something like this.

It would be cool if we could quickly wrap anything we wanted into xojo. It would save a lot of time! And if we could wrap all of them for each platform then we could implement a single class that calls the wrapped classes for each platform and do essentially what the Xojo Classes do. Does anyone else see how amazing this would be?

I’m not aware of anything that does this

The real problem is to know the parameters required by the exported functions.
AFAIK these informations aren’t available in the DLL itself.

Thats very true
That usually is in a header or something that accompanies the DLL (you hope)
But it’s not usually discoverable from the DLL itself