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 / Porting to DarkBASIC

Author
Message
Khorelis Sylvari
12
Years of Service
User Offline
Joined: 5th Apr 2013
Location:
Posted: 5th Apr 2013 20:03
Just have a quick question and would like some feedback as to the potential possibilities. Would it be possible to port an old code base that was written in C into DarkBASIC? Normally I would not ask such a dumb question because of course you can port just about anything, if not everything into DarkBASIC. My question is a bit deeper than that. In the code base it references the C header libraries such as signal.h, stdio.h, sys/time.h, sys/resources.h, etc.

After reading the book I noticed that there are soo many things in DB that are handled for you, but my question is are these also included in DarkBASIC? For instance, could I simply just declare it as it is in C? Such as:

#INCLUDE <stdio.h>

If it's not that easy, how would I go about being able to port the code over if it uses vital C header files that I can't access using DB?

Thanks for any and all information that anyone can provide!
Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 6th Apr 2013 15:44
Quote: "I simply just declare it as it is in C? Such as:"

no

Quote: "If it's not that easy, how would I go about being able to port the code over if it uses vital C header files that I can't access using DB?"

you will have to create a dll in c++ and use that instead.
You can use dll functions as dbpro commands but dll needs to be formated properly so dbpro can recognise which functions you want to use and in which format. Check out dll subforum, there could be some open source examples of plugins. Also, in dbpro help files there's a tiny tutorial how to make a plugin

mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 12th Apr 2013 16:06
It's non of my buisness, but... why? C is better if you can program.

«Just because you’re unique, doesn’t mean you’re useful»
Rudolpho
19
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 13th Apr 2013 02:36
If you look up the functions you're using on MSDN it usually says what library they are found in. A lot of the time there is a corresponding dll file that you can load into DBP and call the functions from.
It requires quite the workarounds if your functions make use of structs / classes though. Callbacks are also not well handled by DBP.

Otherwise I think I'd have to agree with mr Handy, why choose DBP for this? Do you intend to incorporate 3D graphics into some old application of yours or similar?
If so you might be better of looking at DarkGDK (since it is made up of C++ libraries that you could then use alongside your mentioned code).


"Why do programmers get Halloween and Christmas mixed up?"
mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 13th Apr 2013 11:06
Yes, DarkGDK is a better choice!

«Just because you’re unique, doesn’t mean you’re useful»

Login to post a reply

Server time is: 2025-05-17 18:49:58
Your offset time is: 2025-05-17 18:49:58