then we get the size of program 27 kb. Can I have a buggy for something? Is there an alternative to this function may not be the API?Var hh=Val("55")
VAL - 27 kb ?
VAL - 27 kb ?
I'm here if you compile this line:
Hi, VANYA. This code produces the expected result for me (FreeBASIC Compiler - Version 0.21.1 (08-11-2010) for win32 (target:win32)):
To see what version you are using, run
from a console window. Perhaps there is a problem in another part of your program ?
Code: Select all
Var hh=Val("55")
print hh ' prints 55
Code: Select all
fbc -version
I'm using the latest version.To see what version you are using, run
I without any line, we obtain already 7.5 kb!fxm wrote:VANYA exclaims just the size of the program (.exe) in compiling this only line.stylin wrote:Hi, VANYA. This code produces the expected result for me (FreeBASIC Compiler - Version 0.21.1 (08-11-2010) for win32 (target:win32))
Without any line, we obtain already 12 kb!
and so, too 7.5 кб:
Thanks to all.#Include "crt/stdlib.bi"
Var hh= atof ("15.44")+atof ("15.66")
The function atof for me.
Yes, I compiled with option -exx as usual!VANYA wrote:I without any line, we obtain already 7.5 kb!fxm wrote:VANYA exclaims just the size of the program (.exe) in compiling this only line.stylin wrote:Hi, VANYA. This code produces the expected result for me (FreeBASIC Compiler - Version 0.21.1 (08-11-2010) for win32 (target:win32))
Without any line, we obtain already 12 kb!
-
- Posts: 248
- Joined: Jul 01, 2010 9:35
Size of an EXE
Since it is the size of the EXE we must remember that there are overheads etc . I think that the compiler loads some minimum functions from the library which depend on other functions/modules to execute the program. Unfortunately FBC is not as termed "an intelligent compiler" as yet so all functions in that module/library even if they are never called become part of the EXE.
I remember when Pascal 5.1 or so was introduced it had an intelligent compiler and the same program on say Pascal 4 which compiled to 15Kb was only 5Kb when the new intelligent compiler was used. The compiler deleted any function etc that was not referenced from where I assume the "Intelligent" comes from.
I hope I haven't missed the point or made some other Booboo this is recalling something from about 20 years ago which since then I have not looked at.
I remember when Pascal 5.1 or so was introduced it had an intelligent compiler and the same program on say Pascal 4 which compiled to 15Kb was only 5Kb when the new intelligent compiler was used. The compiler deleted any function etc that was not referenced from where I assume the "Intelligent" comes from.
I hope I haven't missed the point or made some other Booboo this is recalling something from about 20 years ago which since then I have not looked at.
Re: Size of an EXE
Hi Theunis Jansen.Theunis Jansen wrote:Since it is the size of the EXE we must remember that there are overheads etc . I think that the compiler loads some minimum functions from the library which depend on other functions/modules to execute the program. Unfortunately FBC is not as termed "an intelligent compiler" as yet so all functions in that module/library even if they are never called become part of the EXE.
I remember when Pascal 5.1 or so was introduced it had an intelligent compiler and the same program on say Pascal 4 which compiled to 15Kb was only 5Kb when the new intelligent compiler was used. The compiler deleted any function etc that was not referenced from where I assume the "Intelligent" comes from.
I hope I haven't missed the point or made some other Booboo this is recalling something from about 20 years ago which since then I have not looked at.
I used to use Pascal myself and I always thought that it was an elegant language.
Microsoft, as well as Introducing QB, had a Quick Pascal, I have a copy installed, only about 1Mb, but OOP is available and it produces small exe files and is fast.
Windows 98 had a right mouse click quick view option for files, this would show you all the loaded libraries in an exe file.
I havn't seen it since Win 98, but maybe there's a version somewhere for Win NT, which is the underlying OS for Win 2000, Xp, and I think Vista and Win 7.
Maybe a good project would be to have a QP64, like QB64, and bring forth from DOS a Quick Pascal.
Hmm. Probably because the string can also contain floating point values, a kind of val is used that also supports floating point values, and probably also octal,binary,hex etc.
And "string <-> floating point" are a major part of nearly every (*) language base runtime.
Maybe there is a variant that only handles integers ? (like atoi or so in C, or val,strtoint in Delphi ?).
Btw this is one of the reasons why in Pascal VAL() is a procedure with a by ref parameter, and not a function.
This way, depending on the type passed (integer of float) the compiler can select different overloaded VAL routines.
(*) I mean languages on the level of FB, FPC, GCC here.
And "string <-> floating point" are a major part of nearly every (*) language base runtime.
Maybe there is a variant that only handles integers ? (like atoi or so in C, or val,strtoint in Delphi ?).
Btw this is one of the reasons why in Pascal VAL() is a procedure with a by ref parameter, and not a function.
This way, depending on the type passed (integer of float) the compiler can select different overloaded VAL routines.
(*) I mean languages on the level of FB, FPC, GCC here.
FB might not be an "intelligent compiler" able to discard any unused function in the same module as a function that is being used, but if a library is made up of several modules linked together but only functions in one module are called, it will discard the other modules (unless of course the functions being used depend on functions in the other modules)
In an attempt to determine what is increasing the size of the EXE, I tried removing the not-obviously-essential libraries from the linker command line. For a source consisting of the single statement:
Var hh=Val("55")
If I remove supc++ I get no error, but the EXE size remains at 27KB.
If I remove moldname I get no error, but the EXE size remains at 27KB.
If I remove mingwex I get:
undefined reference to `__strtod'
If I remove gcc I get
undefined reference to `__cmshared_create_or_grab'
Var hh=Val("55")
If I remove supc++ I get no error, but the EXE size remains at 27KB.
If I remove moldname I get no error, but the EXE size remains at 27KB.
If I remove mingwex I get:
undefined reference to `__strtod'
If I remove gcc I get
undefined reference to `__cmshared_create_or_grab'
Re: VAL - 27 kb ?
Hi VANYAVANYA wrote:I'm here if you compile this line:
then we get the size of program 27 kb. Can I have a buggy for something? Is there an alternative to this function may not be the API?Var hh=Val("55")
Intresting to note that on fb18.5 the exe file is 8kb.
Here is a bit of the info produced by Quickview on Win 98 for your single line of code :-
KERNEL32.dll
Functions
AddAtomA
DeleteCriticalSection
EnterCriticalSection
ExitProcess
FindAtomA
GetAtomNameA
GetAtomHandleA
GetProcAddress
InitializeCriticalSection
InterlockedExchange
LeaveCriticalSection
SetUnhandledExceptionFilter
Sleep
VirtualProtect
VirtualQuery
msvcrt.dll
Function Name
__getmainargs
__p_environ
__p__fmode
__set_app_type
_assert
_cexit
_controlfp
_errno
_fmode
_fpreset
_iob
_onexit
_setmode
abort
atexit
exit
fprintf
free
localeconv
malloc
memcpy
realloc
signal
strlen
vfprintf