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 / Calling the compiler from the commandline or an IDE

Author
Message
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 3rd Jul 2005 19:18 Edited at: 3rd Jul 2005 19:20
I have seen a few posts requesting information about this, so here is a brief runthrough of what happens when you click the "Compile" button in the IDE.

1. The IDE collates all of the source code from the main source file and all includes in the project into one source file (usually named _temp.dba or similar). Any preprocessing by editor plugins will be done during this stage.

2. The IDE updates the .dbpro project file. The .dbpro project file is a simple series of key-value pairs, eg. "executable=myapp.exe". Each setting in the IDE usually has one associated key-value pair in the project file. If you open one in Notepad, you'll see that it is mostly self-explanatory.

The "version=DBP1.0.0" entry must be at the top of the file, but otherwise the items can be in any order.

3. A key called "final source" is added to the .dbpro file, where the value is the location of the temporary source file containing all of the project's source code.

4. The compiler (DBPCompiler.exe) is executed, and the path to the .dbpro file is passed on the commandline. Ie. "DBPCompiler.exe <path_to_dbpro_file>"

5. The compiler will create a file in memory called "DBPROEDITORMESSAGE" which allows the IDE to keep track of what the compiler is up to, this can be opened using the OpenFileMapping Windows API command. The first four bytes of this file contain the current line number which the compiler is working on. To get these bytes from the file, call MapViewOfFile to prepare a section of the file for reading, and then use CopyMemoryRead to copy the relevant bytes.

Compilation occurrs in 4 stages (3 parsing stages, then a linking stage). The counter resets after each stage.

Following the first four bytes, there is a null-terminated string (A normal char* string) which contains other progress information.

Note however, that this information is ONLY sent if the compiler can find a windows whoose class name is "TDBPROEDITOR". If it doesn't find that window, it won't create the memory file.

6. The compiler will terminate either due to an error, or when compiling is complete. If it fails due to an error, it will send a WM_USER message to the window with class name "TDBPROEDITOR". A short summary of the error is passed as a string in the DBPROEDITOMESSAGE file (note that the first four bytes are no longer the progress counter, so the null terminated error string starts from the first byte in the file). If compilation is successful, no WM_USER message is sent, and the IDE is responsible for detecting when the compiler closes.

7. The IDE is then responsible for launching the newly-minted program executable.


BlueGUI Windows Plugin
Eddie B
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location:
Posted: 3rd Jul 2005 19:52 Edited at: 3rd Jul 2005 19:55
Nice one! I was doing an IDE but gave up, I might mess about with it later. Cheers

DBAlex
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 3rd Jul 2005 20:12
Nice!

Useful for IDE writers... Which could be me soon...


AMD 64 3000 + 512mb RAM + 80GB HD + Radeon 9600se 128mb
http://www.dbastudios.cjb.net
PowerSoft
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 10th Jul 2005 21:26
Quote: "ONLY sent if the compiler can find a windows whoose class name is "TDBPROEDITOR""



In VB.NET that would be the design name correct?

(sorry if it seems im reviving an old thread but its better than creating a new one.)

Always available to help
PowerSoft
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 12th Jul 2005 01:24
anyone?

Always available to help
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 12th Jul 2005 01:56
Quote: "In VB.NET that would be the design name correct?"


No. The class name for VB7+ / VC# app windows is something like "WindowsForms10.Window.8.app.0.b7ab7b"

I suspect that you would have to dive back into the unmanaged world of the old fashioned Windows API in order to create such a window (assuming VB.NET allows that, and I suspect that it does).


BlueGUI Windows Plugin
Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 12th Jul 2005 02:01
How on earth do you find something like that out?! lol.. Thats certainly not a Trial and Error name

My Website:
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 12th Jul 2005 02:10
Quote: " How on earth do you find something like that out?"


A little birdie called Microsoft Spy++


BlueGUI Windows Plugin
PowerSoft
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 12th Jul 2005 19:27
Does anyone have any knowledge on how to do what Rob suggested?

Always available to help
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 12th Jul 2005 19:33
Yes, run Spy++, and tell it to look at a given window...
It will then list all messages a window is given.

PowerSoft
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 12th Jul 2005 19:34
Is Spy++ free or is it bundled with VS.NET-03?

Always available to help
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 12th Jul 2005 20:24
Comes free with VS.Net 2003 and VS6 if I rememeber correctly.

PowerSoft
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 12th Jul 2005 20:51
cool, ill check it out.

Always available to help
PowerSoft
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 5th Aug 2005 09:44
Im back again.

What is the actual size of the file map Rob or is there any way i can find this out?

Also do you perform the reading of the memory while WM_USER hasnt been sent?

Xolatron old
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: The Star Forge Language: DBpro
Posted: 5th Aug 2005 18:44 Edited at: 5th Aug 2005 18:45
Interesting... DBpro has some undocumented filemap commands - I'll have to get those to work.

Undocumented Command List

-Xol

PowerSoft
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 6th Aug 2005 09:48
They're also in the expansion pack

David R
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location: 3.14
Posted: 7th Aug 2005 18:12
Hi. I've managed to make a DBP app, with the class name 'TDBPROEDITOR', however when I compile it, DBP always adds '12345' to the class name (so I end with TDBPROEDITOR12345)

Any ideas why/how I can overcome this?


################Dream::Catcher#################
ITS COMING. NOVEMBER 1ST
Xolatron old
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: The Star Forge Language: DBpro
Posted: 7th Aug 2005 18:17 Edited at: 7th Aug 2005 18:17
Quote: "I've managed to make a DBP app, with the class name 'TDBPROEDITOR'"

How did you manage that to begin with?

Try putting 5 delete charachters (can't remember the number) after the class name. It probably won't work, but there's a chance.

Are you making an IDE in DBpro also?

-Xol

Keaz
20
Years of Service
User Offline
Joined: 22nd Sep 2003
Location: Somewhere in south Texas
Posted: 7th Aug 2005 18:26 Edited at: 7th Aug 2005 18:27
AppName+12345 is DBPro's Default Class name. What wrong with using it? If you what it too be shortened for cammands use a constant.

Breaking Stuff=Fun!,Bug Testing<>Fun!, Bug Testing=Breaking Stuff, so...
Bug Testing=Fun! Hmmmm....
DOES NOT COMPUTE! SYSTEM MALFUNTION!
Xolatron old
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: The Star Forge Language: DBpro
Posted: 7th Aug 2005 18:59
Keaz, he wants the compiler to recognize it as the editor.

-Xol

David R
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location: 3.14
Posted: 7th Aug 2005 20:12 Edited at: 7th Aug 2005 20:20
Quote: "How did you manage that to begin with?

Try putting 5 delete charachters (can't remember the number) after the class name. It probably won't work, but there's a chance.

Are you making an IDE in DBpro also?
"


I took a look at Spy++, and found that the Class name of a DBP is in fact the same as the apps original title ('Application Window caption'). However, once I changed this from the default (DBP app) it started added 12345 to the end.

I'll have a look into the delete character, thanks . By the way; no I'am not making an IDE.

I've made a very clever little app, which takes DBP source code, encrypts, and then compresses it. The file can then be distributed, and decrypted by other users on a decryption program (which doesn't require a password etc.). After the code has been Decrypted back into source, it is compiled and run. This could be a very useful tool; and file sizes are tiny compared to the giant EXE's that DBP pumps out


EDIT: In fact, here's a little demonstration of an output file from my app. Its a zipped up encrypted file. Try opening it Wordpad. You'll see its quite hard to decrypt The example is the Fizz dba library.


################Dream::Catcher#################
ITS COMING. NOVEMBER 1ST

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-05-03 17:19:06
Your offset time is: 2024-05-03 17:19:06