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 Professional Discussion / Any good tutorial how to write DLL for DBpro

Author
Message
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 7th Jun 2003 05:11
I know C++, and I usually write DLL for my Windows application using Visual C++.

I just wish to know the guidelines that I need to follow for writing DLL for DBpro, or you guys called it TPC right? Is there any specifc functions I must implement in the DLL, i.e. Init(), Destroy(), etc. Or I just need to implement whatever functions that is needed for my DLL.

Thanks!
Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 7th Jun 2003 05:51
And how does DBpro maps its data type with the C++ data type?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
abloke
23
Years of Service
User Offline
Joined: 6th Jun 2003
Location:
Posted: 7th Jun 2003 06:46
I would also appreciate any help with this question.
If there is a small tutorial around,would be a great help.
Thanks.

The Darthster
23
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 7th Jun 2003 13:24
There's one in the DBPro help files, under Technical Documents/Third Party Commands.

Once I was but the learner,
now, I am the Master.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Jun 2003 13:29
Coding for DBP is just like coding a DLL for any other program now... it can range from simple intergration to complex workings of instance manipulation and such.

the Help file was good enough for me to learn the generals, but asking here also gets good and insightful responses from Toady and Ian
there isn't currently any step-by-step though for coding them.
if you have anything you need to know just ask and peeps will try to answer if we know.

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Jun 2003 13:51
@Bullseyes

You only have to write the functions for use in your apps, no need for Init() or Destroy(). You must use the cdecl calling spec from Delphi DLLs, and that might apply to C++ as well.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Jun 2003 17:25
If you are using VC++, have a look at my site. You'll find a framework there that I've fairly heavily commented. Using that alongside the technical document that you should already have, should allow you to work it out.

Of course, if you have any problems, just ask
squids
23
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 7th Jun 2003 17:40 Edited at: 7th Jun 2003 17:41
A nice dumb newbie question, hurrah!

After someone has made their massive DLL full of funky functions,.. Is that it,. are the functions only required to compile the application with,.. and after they have been used in your DB/P program they are no longer needed,.. So the DB/P application is still a stand alone executable,. unless you used a DLL and other resources directly related to the way your application worked,..?

hmph >.<

Ash.

...one day ill learn to write...

.Arf..
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 7th Jun 2003 17:46
Yes, the plug-ins are only needed on the machine thats compiling the program.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Jun 2003 21:22
Indeed... the compiler will automatically pack the DLL into the exe, like all the core DBP DLLs.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
Bighead
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location:
Posted: 7th Jun 2003 22:43
Does anybody know how to make dlls for DBP with Dev-C++?

I followed the steps included in the Third Party Commands section of the Help files, and although the dll is compiled with Dev-C++, the example code doesn't work ... [img] [/img]
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Jun 2003 23:31
I keep meaning to try it with Dev-C++, but somehow something always comes up.

What errors do you get?
Bighead
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location:
Posted: 7th Jun 2003 23:54
First of all, when I compile the dll, DEV-C++ displays: "
Creating one, but that may not be what you want"

Then when I use, for instance: PRINT TEXT "Hello World", DBP displays:

Could not find function '?PrintText@@YAXPAD@Z' in 0: core.dll
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Jun 2003 00:04
It looks like you copied the resource string exactly - and that won't work for anything but VC++ because C++ compilers for Windows all use different name mangling schemes.

Follow the instructions in the document for getting the function name from the DLL and try it again.
Bighead
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location:
Posted: 8th Jun 2003 00:26
Well, actually what i did was import the VC project into Dev-C++ and then compile the dll...

What document are you meaning? The one in DBP Help Files? I read it once and again but I don't find how to solve this ...

How should the resource string look under Dev-C++?
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Jun 2003 00:37
you should open the DLL itself up in something like notepad after compiling, then copy the string which contains the function names to the resource table.

however for Dev-C++ really what you'd want to use is a C .def, i'll see about getting up a quickie explaination of it because it'll help anyone who wants to use Codewarrior or Borland as well.

i'd do it now but i'd wanna test first and i've got almost nothing installed right now

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
Bighead
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location:
Posted: 8th Jun 2003 04:16
Raven, you're right! As you suggested I edited the .dll with the notepad and looked for each example function. Then I replaced the strings in the table within the resource file what resulted in:



Therefore, after importing the VC project to Dev-C++, all you need to do is changing those strings.

Now the example code works. Thanks all for your help!
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 8th Jun 2003 06:53
Sweet, I love you guys!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Jun 2003 19:00
yw BigHead... saves me the trouble of explaining .defs :: mumbles "thank god" ::

Quote: "Sweet, I love you guys!"

obviously ment in the way that only guys do ... never confused

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 8th Jun 2003 19:11
lol, maybe not Raven, I still cant get my Borland DLLs working

Whatever I did I didn't do it!
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Jun 2003 19:54
wouldn't just doing something like

mainfunction.cpp


resource.h


or something like that anyways

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
Bighead
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location:
Posted: 9th Jun 2003 01:03
Does anybody know whether is it possible to wite a dll for DBP using C#? If so, how and where do I have to define the strings for the functions?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Jun 2003 01:40
It isn't. C# produces managed code, and DBPro only accepts native DLL's.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 9th Jun 2003 01:41
Doubtful using C# - its a managed language.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!

Login to post a reply

Server time is: 2026-07-11 11:42:39
Your offset time is: 2026-07-11 11:42:39