forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


c++ dll that generate VDS event

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up
View previous topic :: View next topic  
Author Message
dangt
Newbie


Joined: 19 May 2009
Posts: 20

PostPosted: Fri Jun 26, 2009 8:13 pm    Post subject: c++ dll that generate VDS event Reply with quote

Can someone post example of how to create a dll in C/C++ that generate a VDS event?
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Sat Jun 27, 2009 5:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 412
Location: Australia

PostPosted: Sun Jun 28, 2009 5:22 am    Post subject: Reply with quote

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. Wink

thanks

_________________
cheers

Dave
Back to top
View user's profile Send private message Visit poster's website
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Jun 29, 2009 1:32 pm    Post subject: Reply with quote

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. Wink 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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
dangt
Newbie


Joined: 19 May 2009
Posts: 20

PostPosted: Mon Jun 29, 2009 4:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Jun 29, 2009 9:35 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
bornsoft
Contributor
Contributor


Joined: 19 Feb 2009
Posts: 113
Location: Germany

PostPosted: Tue Nov 09, 2010 6:50 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group