Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 30, 2005 Windows bug: _fileno undefined? | ||||
---|---|---|---|---|
| ||||
If i compile this simple program: #### module test; private import std.c.stdio; int main(char [][] args) { FILE* f; f = fopen("main.d", "r"); printf("%i\n", fileno(f)); fclose(f); return 0; } #### i get the following error message under windows (dmd 0.127): #### obj\test.obj(test) Error 42: Symbol undefined _fileno --- errorlevel 1 #### But fileno() is defined in std.c.stdio: #### version(Win32) { // some code... int feof(FILE* fp) { fp._flag & _IOEOF; } // some code... int fileno(FILE* fp) { return fp._file; } // some code... } #### Funny is, if i replace fileno(f) in my program by feof(f), it works. As you can see above, feof() is defined only a couple of lines before fileno(). So what? Ciao uwe |
June 30, 2005 Re: Windows bug: _fileno undefined? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Uwe Salomon | > i get the following error message under windows (dmd 0.127):
>
> ####
> obj\test.obj(test)
> Error 42: Symbol undefined _fileno
> --- errorlevel 1
> ####
The same goes for _bufsize(), by the way. feof() and ferror() work perfectly. It seems to me that the very simple form of fileno() and _bufsize() produce the problem, they are both like this:
####
int someFunc(void* someStruct)
{
return someStruct.someMember;
}
####
Ciao
uwe
|
June 30, 2005 Re: Windows bug: _fileno undefined? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Uwe Salomon | It's especially odd because if you add:
extern (C) int fileno(FILE *fp) { return fp._file; }
to the top of the source it suddenly starts linking. It even seems to produce correct results (prints "3" for me).
Regan
On Thu, 30 Jun 2005 11:24:46 +0200, Uwe Salomon <post@uwesalomon.de> wrote:
>> i get the following error message under windows (dmd 0.127):
>>
>> ####
>> obj\test.obj(test)
>> Error 42: Symbol undefined _fileno
>> --- errorlevel 1
>> ####
>
> The same goes for _bufsize(), by the way. feof() and ferror() work perfectly. It seems to me that the very simple form of fileno() and _bufsize() produce the problem, they are both like this:
>
> ####
> int someFunc(void* someStruct)
> {
> return someStruct.someMember;
> }
> ####
>
>
> Ciao
> uwe
|
June 30, 2005 Re: Windows bug: _fileno undefined? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | > It's especially odd because if you add:
>
> extern (C) int fileno(FILE *fp) { return fp._file; }
>
> to the top of the source it suddenly starts linking. It even seems to produce correct results (prints "3" for me).
Yep. Somehow the fileno() function is not included in the library, or the linker does not find it...
|
Copyright © 1999-2021 by the D Language Foundation