View previous topic :: View next topic |
Author |
Message |
Bart Valued Newbie
Joined: 24 Jun 2003 Posts: 41 Location: Netherlands
|
Posted: Wed Jan 24, 2007 12:04 pm Post subject: Writing a VDS-DLL in VDS? |
|
|
Hi,
Is it possible to write a VDS-DLL in VDS? Because i need to write a DLL like program that can generate events and have functions and commands to control different external equipment, but needed to have only one main program because that has to be updated frequently on different machines with different equipment and so i don't have to worry what the controls for that equipment are because they are controlled by the DLL on that machine.
Bart |
|
Back to top |
|
|
Hooligan VDS Developer
Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Wed Jan 24, 2007 1:24 pm Post subject: |
|
|
Hi Bart,
It sounds to me like what you want is a DSU. It.s sort of like a dll, but written entirely in VDS. A search of the forums on "dsu" should find you plenty of info on making them...
Hooligan _________________ Hooligan
Why be normal? |
|
Back to top |
|
|
Bart Valued Newbie
Joined: 24 Jun 2003 Posts: 41 Location: Netherlands
|
Posted: Wed Jan 24, 2007 2:14 pm Post subject: |
|
|
But as far as i understood is that a DSU compiled into the exe file, so i still need to compile for every different hardware setup a exe file and that is what i want to avoid. |
|
Back to top |
|
|
jwfv Valued Contributor
Joined: 19 Mar 2002 Posts: 422 Location: Beaufort, SC
|
Posted: Wed Jan 24, 2007 5:20 pm Post subject: |
|
|
A DSU is a standalone file that you can reuse with as many executables as you want. So for instance, you might have 5 .exes running that are all calling functions from the same .dsu. _________________ Joe Floyd |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
Bart Valued Newbie
Joined: 24 Jun 2003 Posts: 41 Location: Netherlands
|
Posted: Thu Jan 25, 2007 8:28 am Post subject: |
|
|
jwfv wrote: | A DSU is a standalone file that you can reuse with as many executables as you want. So for instance, you might have 5 .exes running that are all calling functions from the same .dsu. |
I tested it but the executable running without the original DSU on a computer so i assume the DSU is compiled into the EXE (correct me if i'am wrong)
@skit: I gonna look into it, thanks. |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Thu Jan 25, 2007 1:51 pm Post subject: |
|
|
Yes, a DSU is compiled into the EXE. It's more like a LIB or OBJ file in other languages, or a Delphi DCU.
It is not possible to create DLLs using VDS. VDS 6 will have the ability to create a number of different executable types, such as standalone runtime-free EXEs, console EXEs and NT Service EXEs, but the ability to create DLLs would have involved considerable extra work and it was deemed not worth the effort when compared to other things the time could be spent on. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
jwfv Valued Contributor
Joined: 19 Mar 2002 Posts: 422 Location: Beaufort, SC
|
Posted: Fri Jan 26, 2007 1:10 am Post subject: |
|
|
I think I misunderstood your original question. Yes, a dsu is included in the script at compilation time. I thought you just wanted a single place to put reusable functions, and then include that dsu in all your programs. Sorry if I confused the issue - _________________ Joe Floyd |
|
Back to top |
|
|
Bart Valued Newbie
Joined: 24 Jun 2003 Posts: 41 Location: Netherlands
|
Posted: Fri Jan 26, 2007 2:11 pm Post subject: |
|
|
Skit, i tried gateway.dll but it crashes sometimes for no reason, mostly when sending a lot of data trough it in a short period of time, is this a known problem? |
|
Back to top |
|
|
Bart Valued Newbie
Joined: 24 Jun 2003 Posts: 41 Location: Netherlands
|
Posted: Fri Jan 26, 2007 2:16 pm Post subject: |
|
|
jwfv wrote: | I think I misunderstood your original question. Yes, a dsu is included in the script at compilation time. I thought you just wanted a single place to put reusable functions, and then include that dsu in all your programs. Sorry if I confused the issue - |
No prob, i never used DSU files before so now i know how they do there job |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Jan 26, 2007 8:09 pm Post subject: |
|
|
Bart wrote: | Skit, i tried gateway.dll but it crashes sometimes for no reason, mostly when sending a lot of data trough it in a short period of time, is this a known problem? |
To be honest, I didn't really create the DLL myself I took the source code of Prakash' vdsmem DLL and changed some function names and added event support. I also don't know if it can have anything to do with VDS 5; not all DLLs which are created for previous version work without problems.
If you are sending a lot of data between the applications, another solution might be to set up an TCP/IP connection with localhost. _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Jan 30, 2007 10:18 am Post subject: |
|
|
Skit3000 wrote: | I also don't know if it can have anything to do with VDS 5; not all DLLs which are created for previous version work without problems. |
I seem to remember there is a problem with the example Delphi code for creating a VDS extension. It passes a string result that is created on the stack. When compiled with Delphi 2 the same as the VDS runtime this didn't seem to matter but later versions of Delphi use a different memory manager. The solution is simply to ensure that the variable containing the result that you pass back is declared in the main program block not in the function itself. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Jan 30, 2007 2:14 pm Post subject: |
|
|
Jules & Skit,
There is an update to the Delphi extension template in the Articles section here at http://www.vdsworld.com/search.php?view_mode=fileinfo&file_id=6
However I doubt that the issue is anything to do with sending parameters. Most likely it is due to the size of the shared memory mappings that are being used in the Gateway.dll... You pobably need to limit the amount of data your sending or send memory addresses using the @addr() function in VDS. This way the data is not on the stack and is in heap memory. In most cases the stack for a single function is only 4096 characters. Keep your data below that and it will probably do ok. I am only speculating here and have not seen the source code of the DLL myself but if Skit used the code from a DLL that PGWare wrote then it should be compatible with VDS 5 since I remember him stating that all his DLL's were updated to work with VDS 5. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
Bart Valued Newbie
Joined: 24 Jun 2003 Posts: 41 Location: Netherlands
|
Posted: Tue Feb 13, 2007 10:19 am Post subject: |
|
|
Skit3000 wrote: | If you are sending a lot of data between the applications, another solution might be to set up an TCP/IP connection with localhost. |
Sorry for the late response but thanks for the tip, i gonna try it. |
|
Back to top |
|
|
|