View previous topic :: View next topic |
Author |
Message |
dangt Newbie
Joined: 19 May 2009 Posts: 20
|
Posted: Fri Jun 26, 2009 8:13 pm Post subject: c++ dll that generate VDS event |
|
|
Can someone post example of how to create a dll in C/C++ that generate a VDS event? |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Jun 27, 2009 5:27 pm Post subject: |
|
|
Dangt,
I have posted the C source code of a fully functional VDS DLL written in C. Anyone is welcome to use the code to build VDS DLL's with C/C++ I have donated the code to VDS users. You can download the code from mpSelect Enjoy. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
DaveR Valued Contributor
Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Sun Jun 28, 2009 5:22 am Post subject: |
|
|
dragonsphere wrote: | I have posted the C source code of a fully functional VDS DLL written in C. |
Excellent. I was wondering why I'd never found this before... until I noticed the date.
thanks _________________ cheers
Dave |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Jun 29, 2009 1:32 pm Post subject: |
|
|
Actually Dave this was posted to the old VDSWorld Developers forum but did not get moved to this forum and I did not realize it. So I added to the list of my files here at vdsworld to make sure it stays. I have not touched this code in a long time so it may have issues but it should be good enough to use as an example to get you started. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
dangt Newbie
Joined: 19 May 2009 Posts: 20
|
Posted: Mon Jun 29, 2009 4:13 pm Post subject: |
|
|
Thanks ds for the code.
I'm looking at the example code and it occurred to me that I need to call my dll using "external" instead of "LoadLib" if I want to generate an event. Is that correct? |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Jun 29, 2009 9:35 pm Post subject: |
|
|
Yes that is very correct. LoadLib loads non-VDS DLL's. The External command loads DLL's that extend the language of VDS such that the abilities of a VDS extension (ie... DLL) become commands and functions for the language to use. Primarily the Init function in the DLL example is called by the External command to give it the Address of the VDS Event function. When your extension DLL calls the event function VDS will place the event on an internal Last In Last Out (LILO) queue. Items (ie...strings or char * in C) should be kept permanent so that their addresses will still be valid for when the VDS event queue try's to use them if not you will get memory errors. So I suggest that you build your own queue or allocate the strings in a garbage collector to manage their life span. My other VDS extensions use a queue fashioned similar to the VDS queue. The way you manage this will be up to you and the C/C++ compiler you are using. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
bornsoft Contributor
Joined: 19 Feb 2009 Posts: 113 Location: Germany
|
Posted: Tue Nov 09, 2010 6:50 am Post subject: |
|
|
Hi Vdsalchemist,
I've downloded your C-dll example and tried to compile with Lcc-win32. I always get the message from make.exe "Commands defined twice for target ... near line 22".
It's the first time I use a C-compiler and I did not change anything from the defaults except the mentioned underscores.
I'd like to use your code as a skeletton for my own function, but first I have to get this working. Is there something special I have to pay attention to?
Thankx. bornSoft
. |
|
Back to top |
|
|
|