Qbasicnews.com

Full Version: prob with crt and IUP (was: How to switch to case sensitive)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
In a c header file that I'm converting to bi are definitions for keyboard keys like:

#define IUP_K_A "K_A"
#define IUP_K_B "K_B"
#define IUP_K_C "K_C"

Now there are also definitions for these:

#define IUP_K_a "K_a"
#define IUP_K_b "K_b"
#define IUP_K_c "K_c"

and the compiler says that IUP_K_a is already defined (because IUP_K_A is already there...).

How can I solve it?
The IUP libraries need both... Cry
You're going to need to make some changes to the defines. BASIC by its very nature does not allow case sensitivity like that, and never should. In my professional opinion, case sensitivity is one of C's many shortcomings.
Yeah, you have to use l or _ as suffix on the lower case ones..

Btw, if it can help ya: http://fbc.sourceforge.net/iup-headers.zip (10 minutes to translate ;).. if you find any error, post it, i didn't try to create any test, only included the headers to check for dups..
Thanks Victor, these are exactly the files I started to convert (reinventing the wheel I guess...).

Wanted to look into iup a bit...

BTW:
in your bi file it's:
#define K_A_ asc("A")
#define K_B_ asc("B")
#define K_C_ asc("C")

#define K_a_ asc("a")
#define K_b_ asc("b")
#define K_c_ asc("c")

so no probs here.

Thanks again.
And yes I will report any bugs...
Quote: In my professional opinion, case sensitivity is one of C's many shortcomings.

I'm not a professional coder...
... and because of this I hoped that Victor would answer:
Quote: Oh, no problem, I will add a compiler switch for that...

Thanks guys....
...waiting for the 'case sensitivity switch'...
:lol:

...ouch, please don't hurt me :wink:
case sensitiviry should never ever happen first thing it's in direct violation of BASIC standers for the language (adding stuff to the lang is one thing when you start to mess with the core syntex then you no longer have basic).

also Case sensitivity promotes some very bad coding partices like having multiable varible with differn't type which makes anyone outside the orignal coder really hard to fallow the code

also if victor did add case senitivity switch it would simple piss a lot of us off some things are sacred.
can't get IUP to compile.
there are 3 things missing:
  • strnicmp
    strdump
    stat

these functions should be declared in crt.bi...
Added this:
Code:
declare function    strnicmp    CDECL alias "strnicmp"    ( byval string1 as string, _
                                  byval string2 as string, _
                                  byval size as integer ) as integer

declare function    strdup        CDECL alias "strdup"    ( byval string as string) as string ptr
to the bi file (didn't find the stat function anywhere...) but get still errors complaining: undefined reference to strnicmp, strdump, stat.

BTW:
found stat in libcrtdll.a but as far as I remember this lib shouldn't be used.
Also changed alias "strnicmp" to alias "_strnicmp" (same with strdup) but it doesn't help either.

Oh well...
Are you linking to it statically? I would use the dll version, dunno.

The 3 functions listed are part of the msvcrt dll, but they have an underscore before the names (declaring them at crt.bi won't help). With mingw they are in the libcoldname.a static lib, copy it to lib\win32 and add #inclib "coldname" to the uip.bi header.

Edit: these are the libs needed to get it to compile statically:
#inclib "coldname"
#inclib "user32"
#inclib "gdi32"
#inclib "comctl32"
#inclib "comdlg32"
#inclib "shell32"
#inclib "version"
#inclib "advapi32"
#inclib "ole32"

The generated exe was 211k.. i wouldn't really use the static lib ;)
Quote:Are you linking to it statically? I would use the dll version, dunno.
Yes.
Wanted to see how small/big a normal exe file would be.
Expected it to be small - because on their homepage they claim to have build a small gui lib - but a normal exe with ONE messagebox is 200Kb. :o
Well maybe compared to a 'hello world' exe compiled from c code using wx (over 1Mb...).

Also I wanted to see how it works out placing buttons and such without coordinates....
Weird somehow.

Quote:The 3 functions listed are part of the msvcrt dll, but they have an underscore before the names (declaring them at crt.bi won't help). With mingw they are in the libcoldname.a static lib, copy it to lib\win32 and add #inclib "coldname" to the uip.bi header.

Yes, yes, yes!
This did the trick.

Victor, thank you helping me out with your seemingly never ending knowledge.

Regarding IUP:
Have you worked with it?
Do you like it?

Somehow I like statically linked apps better, because they are self sustaining exe's.
As soon I add:

#include "iup/iupcontrols.bi"

I get error messages all over the place saying:

undefined references to cdLine
undefined references to cdNativeFont
undefined references to cdClip
undefined references to cdForeground
undefined references to cdText
etc.

can't find where these come from (from the iup package).

Anyway, regarding the size of a statically linked iup-exe, 200Kb is not too bad.
I've seen sample programs with more controls on it and the size was still 230Kb, with full resizing of group boxes and comboboxes when the window is resized...
Pages: 1 2