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 / Separate Source files

Author
Message
vgking101
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location: Virginia
Posted: 18th Apr 2005 03:18
Is it possible to have a few different source files for a large game? Like C++ where you can Include other files. Possible or not? Thankss
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 18th Apr 2005 05:07 Edited at: 18th Apr 2005 05:09
vgking101,

I am greatly pleased to say yes to this question. If you check in the DarkBasic's command list, within basic, you will find the #INCLUDE command. It's syntax being #INCLUDE Filename String. With this command, you can make use of functions from other .dba files. Just include the .dba file(s) that hold the functions you wish to use, and then you can call the functions from within your main program file.

I'm not sure if there are limits to how many files you can include.

+NanoBrain+
vgking101
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location: Virginia
Posted: 18th Apr 2005 06:27
thank you thank you!
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 24th Apr 2005 03:30 Edited at: 24th Apr 2005 03:32
Aah. When you get onto BIG projects, stuff starts to get FREAKY.

For example, take this:

FreeStuff.dba:


ACube.dba:


RunThis.dba:


So the dependencies are as follows:

Quote: "
FreeStuff.dba <----------------- RunThis.dba
FreeStuff.dba <-- ACube.dba <--- RunThis.dba
"


Key:
(This Would Be Relied On By <--------- This)

What DBC actually does, is it processes the #include's and puts them all in one big temporary file.

So, in theory, in processing RunThis.dba, it sees an #include for FreeStuff.dba and sticks all the functions in there at the bottom of the RunThis.dba, then it sees ACube.dba included, so it processes THAT file, only to see ANOTHER include for FreeStuff.dba....

End result? DB ends up with two FindFreeObject() functions.

Now, in this example, it's pretty clear that you can just take the #include out of ACube.dba, and everything will work nicely.

However, when you make it so that your include'd files can actually be run as programs, (for diagnostic reasons), then..... well, problem.

How's my typing? Phone 0800-GO-TO-HELL

Login to post a reply

Server time is: 2025-05-23 13:06:35
Your offset time is: 2025-05-23 13:06:35