Library Suggestion

Lionello Lunesu lio at remove.lunesu.com
Tue Mar 28 02:04:34 PST 2006


"Jeremy" <Jeremy_member at pathlink.com> wrote in message 
news:e0968a$1nbm$1 at digitaldaemon.com...
> OK, I have another idea for easier library integration. :)
>
> You have this at the top of your code:
>
> #pragma(lib,"whatever.lib")

It's pragma without the #.

> instead of having to do an "extern(C) void whatever_func010(int, int)" for 
> every
> function, just grab this information from unresolved symbols. Like:
>
> --------------------------
> #pragma(lib,"whatever.lib");
>
> int main() {
> int a, b;
> whatever_func010(a,b);
> return 0;
> }
> --------------------------

I can see how this would help, but what if you use constants in the function 
call? Like, whatever_func(1,2);
How does the compiler know the types of the prototype? They can be int, 
uint, long, ulong, byte, ubyte. In fact, they can get promoted to 
float,double,real as well. The only way around this is to assume "int" in 
these cases, but that sounds like C's behaviour (assuming int when no type 
is present) and frankly I think it's pretty vague reasoning.

Lio. 





More information about the Digitalmars-d mailing list