Flyzone wrote:Yes, I assumed compiled tho I guess I used the wrong terminology. So, a .bi file can be created and the function(s) then stored in a lib.bi somehow then referenced without fanfare in another source. Perhaps I need some sort of EXTERN statement (or not would be better) though there is still the matter of whether the DECLAREs would still be required or not.
I am used to using "old school" 2 pass compilers which were much more convenient and did all this stuff for you. With processors so fast and cheap today is seems to me we got it backwards with one-pass. Yes, they're faster but whose work are we trying to speed up? But that's just ole' me I guess...
I'm not sure what the source of your difficulties here is. Are you familiar with other languages? The way FB works is no different than C, for example. A bi file contains prototypes and structures that the user of a library needs to know in order to call the library functions. This includes the "declare function" and "declare sub" statements. The dll contains the actual implementation of the library functions and could be compiled from a completely different language like C. In short, how FB behaves is nearly identical to C where .bi files are called "header" .h files. Some C compilers may allow you to forward reference a function in the same source code unit (file) without an advance declaration. Others do not. I'm not able to determine what the C standard has to say on the matter, but all code I've ever looked at defines the function prototype before any forward references are made. Certainly to use any kind of library you need a header file or a .bi file to tell the compiler how to build the structures you'll need and tell the compiler what the function names are and how they are called.
On the issue of forward referencing, apparently Quick Basic had no issue with forward referencing a function without any sort of advanced declaration. FB does not allow that, nor can I think of a good reason to allow that.
Modern compilers tend to be single pass for initial parsing, and then after that there might be multiple passes through the abstract syntax tree for a variety of reasons including symbol type resolution and optimization.