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 / FUNCTION parameters?

Author
Message
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 01:30 Edited at: 8th May 2003 01:49
I must be going mad but can anybody tell me whats wrong with the following code

File: Init.dba



If you #include this code as a separate source file and then attempt to compile the project, DBPro moans about the parameters passed to Check Display Mode in InitVideo.

If I change the nWidth, nHeight and nBpp to actual integer values, it then complains about the parameters to Set Display Mode in the same function further down. Now, to me, this is valid basic and I can't understand why it complains about the variable parameters.

I'd br greatful if someone could enlighten me

PS, ERR_OK and ERR_FAILED are 1 and 0 respectively. Just define them as costants.

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 8th May 2003 01:43
You dont have APPNAME defined, and you've got a = sign missing of a couple of lines. Once those are fixed, it should work with #include - does for me anyway...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 01:46
Ahh, hang on....

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 01:48 Edited at: 8th May 2003 01:50
No, It's the filtering on the forum, but that condition actually has a Greater and Less than sign between the function call and the ERR_ok. Also APP_NAME is a #constant string defined in the main source file. Either way, it still fails to compile. i've edited the post above to ensure that condition is how it should be.

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 01:53
Let me look at this again, I'll be back!!

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 8th May 2003 01:54
So the following doesn't work then...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 02:01
With that code you posted, I get a compiler err number #100008 Invalid parameters for Check Display Mode, Damned if I know why it doesn't compile.

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 8th May 2003 02:02 Edited at: 8th May 2003 02:03
Point is that it won't compile if you include it from another program. Think I read somewhere it is to do with types or constants not transferring properly to includes (but I may be talking rubbish). Whatever you try, it refuses to compile.

P.S. compiles quite happily on its own

Gronda, Gronda
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 02:06 Edited at: 8th May 2003 02:06
Ahh, so I'm fighting a loosing battle here. Jeez, not another bug! This is driving me up the wall.

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 02:52
Does this mean that I can't even create a simple function as above without having to deal with issues like this?

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 03:28 Edited at: 8th May 2003 03:28
I'm sorry if I sounded unfair, not really in my nature, just alot going on here at the mo , hassle from the bank etc.

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
CloseToPerfect
23
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 8th May 2003 03:59
"Does this mean that I can't even create a simple function as above without having to deal with issues like this?"


no, it means the include feature is more or less useless. I completly give up on tring to develope libraries to include in programs because of stuff like this.

CTP
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 04:21
CloseToPerfect, well thanks m8, I'll just have to start again then. Bit annoying though. I suppose the include files are only good for constant declarations then!

Cheers anywayz

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 8th May 2003 12:03
Its odd - the code I posted compiled and run perfectlly - do you have Patch 4?

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 13:45
Yeah, DBPro + Patch 4. The thing is, are you compiling it as the main source file or are you compiling a project with this file #include'd as part of the main source file?

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th May 2003 15:07 Edited at: 8th May 2003 15:08
This all works OK for me. The only problems I've encountered with included source is with arrays, and I have an acceptable work-around for that.

In fact, I've built up a respectable set of library code in include files.

I've only got Patch 3.1 with me at the moment (lunchtime @ work ), so I'll try it again later tonight.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 8th May 2003 15:27
I've tried using #include and adding it via the project system

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 15:36
IanM, I'll be interested to find out if it is just me or whether It's a patch 4 issue. The trouble is, If I go back to Patch v3.1, I get other issues to do with .X files. Could you let me know though if it is something to do with the code or Patch 4.

Cheers

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th May 2003 21:21 Edited at: 8th May 2003 21:22
I've just tried it, and it all compiled OK.

Can you try something?

Create a new project called 'test include', save it, and then quit out. Copy your Init.dba into your project folder.

Using notepad or wordpad, edit your 'test include.dbpro' and overwrite everying with this:



Now reopen the project, and paste this code into your main source file - nothing very clever. Just enough to test the compiler.



Compile and run - does it work?
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 21:36
IanM, ok mate, I'll give it a bash, I'll let you know what happens

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 21:53
I'll be damned, it compiled! I had to add the extra constand APP_NAME, but other than that, it compiled. I see what I'm doing wrong here though, Instead of using the #include directive in the main source file, I just add the extra files to the include file list of the project browser, is that right?

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th May 2003 21:56
Aha, so that's what you're doing. Yes, you're right. The old way is the wrong way in this case.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 22:04
IanM, Listen mate, thanks very much for all your help. D'you know, this thing has been giving me grief for ruddy ages. I just couldn't work out what the hell I was doing wrong. Thanks anywayz

....Pint in for ya

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th May 2003 22:22
I'll remember that if you're going to the convention.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th May 2003 22:30
LOL, afraid not mate, looking for a place for me and Tanya, (my wife) to live so money's a real issue at the moment

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.

Login to post a reply

Server time is: 2026-07-11 12:02:04
Your offset time is: 2026-07-11 12:02:04