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.

DarkBASIC Discussion / Creating DLLs with DBC and the Enhancement Pack

Author
Message
Video Boy
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location:
Posted: 18th Feb 2005 03:37
Is there a tutorial to learn how to do it? And is it possible to use Dev-CPP for it?
Please note that I don't need a general C tutorial: I have a good knowledge of the language, but I never made a DLL nor a Windows program with it (most of my experience with C is its use to make firmware for microcontrollers).
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 18th Feb 2005 07:24
You're probably best off searching the net for something.

I, myself, don't know how to do it, but I'm sure I could learn from other people's tutorials/posts/discussions etc on other sites

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
Video Boy
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location:
Posted: 27th Feb 2005 17:36
Can't you (or anyone else) even direct me to a site where I can start learning about this?
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 27th Feb 2005 18:19
As I said, I don't know about it.

I've never even come close to making DLL's before, so I wouldn't have a clue where to start.

Again, just search google for tutorials

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 28th Feb 2005 08:06
Look in extras, there should be a sample dll.

Something to doing?
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 28th Feb 2005 08:20 Edited at: 28th Feb 2005 08:28
Ok, this short explanation should get you started:

1. Open Dev-C++
2. Make a new project, select DLL from the "New Project" window
You'll get a project with some code in.
3. For the sake of being simple, delete all the code in the project.
4. put "#define DLL _declspec(dllexport)" at the top of your code.

Now make any function this way with DLL in the declaration:



You can also do it this way, with DLL on the opposite side of the type specification:




Now, compile it(note that functions for use from a DLL do not need prototyping), and open it with notepad. Search for the name of your function, and it should display its full decorated name, something like _Z8myfunctionv. Now load up db, create a new project, put the dll in its path, load it into dbpro, then use call dll with the decorated name as the first parameter, and if you have other parameters they go after, like:



If you don't like having to type in function names like that, then enclose the function with the extern "C"{} block, like this:



Now you can call from db like:




You can put multiple functions within the extern "C"{} block.


"Lets migrate like bricks" - Me
Sol462
20
Years of Service
User Offline
Joined: 12th Sep 2004
Location: playing with the spazookeedoo
Posted: 28th Feb 2005 11:49 Edited at: 28th Feb 2005 11:49
first effective dll tutorial i have ever seen. very very very useful, spazuh!

Video Boy
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location:
Posted: 2nd Mar 2005 03:49
YEEAAHHHH!!!! It works!!! Thank you very much Benjamin!
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 2nd Mar 2005 07:04
Your welcome


"Lets migrate like bricks" - Me

Login to post a reply

Server time is: 2025-05-23 21:04:32
Your offset time is: 2025-05-23 21:04:32