Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / create a dll using visual studio C++ 2008 sp1

Author
Message
EDGECOM
13
Years of Service
User Offline
Joined: 7th Sep 2006
Location: US
Posted: 1st Jul 2009 20:22 Edited at: 4th May 2010 17:55
ever wantted to make your own function but dont want the random charters ?myfunction@YBX?@YYZ that come with it? then this is the tutorial for you..

PART 1 Interger functions

STEP 1 creting the empty DLL project

1. open visual studio c++ 2008 Express SP1
2. click: file > new > project
3. click: Win32 on the left pane then click Win32 Project from the right pane
4. click name enter myfistdll and click ok
5. click next click DLL then click empty project click finish

congradulations you just created a blank DLL project

STEP 2 add a cpp file and set compiler options

1. right click the scources folder
2. add > new item
3. click code in the left pane then click C++ File(.cpp) from the right pane
4. click the name box from the bottom and enter myfirstdll then click add
5. click build > Configuration Manager
6. click the configuration dropdown box in the lower window and select release
7. click close

step 3 writting the code and compilling
1. copy paste the following into C++



once you have copied the code click build then build solution or you can press hotkey F7

now copy the compiled dll located in the release foler to your dark basic project folder and copy paste the code below into darkbasic



note: you can add a 3rd function to tell the dll to add subtract etc.... like this




PART 2 String and Char's

thanks to lee's SDK tutoral I figurd out string well for the most part

copy paste this C++ code below



the code above will create a messagebox with your text included in it

Darkbasic pro code



ok I figured its time to update this tutorial a little

the above code is great if you only want to send one huge string but what if you want to send more than one string.

here is a C++ code example of how to build and return a string



Darkbasic pro code



== Free usefull tools ==

anywhere viewer lets you view external functions in dlls and exe files so no more notepad searches

http://www.ucware.com/apev/index.htm#apevdl

just install it then open it drag and drop a dll click on the exports table and you should see functions that any program or exe can use


ResEdit is a free Resource Editor for Win32 programs if your using the VS2008 Express edition it does not come with a resource editor

http://www.resedit.net/
EDGECOM
13
Years of Service
User Offline
Joined: 7th Sep 2006
Location: US
Posted: 1st Jul 2009 20:28 Edited at: 2nd Jul 2009 00:59
Anyone feel free to add comments

I would also like to thank everyone else that has posted eveything thay know on how to make a dll and I figured I would put it all toughter in a tutorial cause people are for ever asking the same question on how to make a dll and hope this will be a one stop thread
Mummy Killer
11
Years of Service
User Offline
Joined: 4th Oct 2008
Location: Slovenia
Posted: 5th Jul 2009 09:20
tnx for this... very good tutorial

Atom Games
10
Years of Service
User Offline
Joined: 11th Aug 2009
Location:
Posted: 1st Nov 2009 02:47
thanks I am serching a LoT for it
The Lone Programmer
16
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 29th Jan 2010 03:43
Sorry if this is already posted, but say I didn't want to include the DLL file in every project.

How do I manipulate the code and make a string table that will satisfy this?

Thanks

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Jan 2010 14:05
It's automatic.

If you don't use a command from the plug-in or an associated plug-in that requests it, then your plug-in will not be included in the compiled exe.

Veeman
14
Years of Service
User Offline
Joined: 4th May 2005
Location: earth smtimes
Posted: 9th Feb 2010 03:57
Cheers EDGECOM ... i read a few tutorials and everything seemed to click when i read yours


thankyou

JavierTF
9
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 27th Feb 2010 22:11
Thanks a lot, EDGECOM. I was looking something like this for a long time. Clear and easy. Great.
EDGECOM
13
Years of Service
User Offline
Joined: 7th Sep 2006
Location: US
Posted: 30th Apr 2010 14:10
thank you all for the compliments
EDGECOM
13
Years of Service
User Offline
Joined: 7th Sep 2006
Location: US
Posted: 30th Apr 2010 14:35
Another usefull tool for everyone

http://www.resedit.net/
EDGECOM
13
Years of Service
User Offline
Joined: 7th Sep 2006
Location: US
Posted: 4th May 2010 18:37
ok I just updated the tutorial

Login to post a reply

Server time is: 2019-10-16 23:12:23
Your offset time is: 2019-10-16 23:12:23