www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - writef bug?

reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
I import std.stdio;

and
writef("Hello");

gives me:

 Error 42: Symbol Undefined _D3std5stdio6writefFYv

when linking!

And i really wanted to figure out how this writef works!
Jul 08 2004
next sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:cck8ng$2mk4$1 digitaldaemon.com...
 I import std.stdio;

 and
 writef("Hello");

 gives me:

  Error 42: Symbol Undefined _D3std5stdio6writefFYv

 when linking!

 And i really wanted to figure out how this writef works!

linux or windows? And is the 0.95 library installed?
Jul 08 2004
next sibling parent "Ivan Senji" <ivan.senji public.srce.hr> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:cckbdk$2qes$1 digitaldaemon.com...
 "Ivan Senji" <ivan.senji public.srce.hr> wrote in message
 news:cck8ng$2mk4$1 digitaldaemon.com...
 I import std.stdio;

 and
 writef("Hello");

 gives me:

  Error 42: Symbol Undefined _D3std5stdio6writefFYv

 when linking!

 And i really wanted to figure out how this writef works!

linux or windows? And is the 0.95 library installed?

WindowsXP, i did what i allways do: extract the new zip over the old ones. The strange thing is that there is a _D3std5stdio6writefFYv string in phobos.lib. I just tried deleting my dm and dmd directories, an re-extracted the zip, and now it compiles and links, but when i run it i get "Test.exe is not a valid Win32 executable" It may be that i am a little tired and doing something wrong, i'll try it on the other computer tomorow! :)
Jul 08 2004
prev sibling parent reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:cckbdk$2qes$1 digitaldaemon.com...
 "Ivan Senji" <ivan.senji public.srce.hr> wrote in message
 news:cck8ng$2mk4$1 digitaldaemon.com...
 I import std.stdio;

 and
 writef("Hello");

 gives me:

  Error 42: Symbol Undefined _D3std5stdio6writefFYv

 when linking!

 And i really wanted to figure out how this writef works!

linux or windows? And is the 0.95 library installed?

I tried it on the other computer and it works(sort of). writefln does work ok writef doesn't print anything with the same arguments!
Jul 08 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:cckk6p$602$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message
 news:cckbdk$2qes$1 digitaldaemon.com...
 "Ivan Senji" <ivan.senji public.srce.hr> wrote in message
 news:cck8ng$2mk4$1 digitaldaemon.com...
 I import std.stdio;

 and
 writef("Hello");

 gives me:

  Error 42: Symbol Undefined _D3std5stdio6writefFYv

 when linking!

 And i really wanted to figure out how this writef works!

linux or windows? And is the 0.95 library installed?

I tried it on the other computer and it works(sort of). writefln does work ok writef doesn't print anything with the same arguments!

try an fflush(stdout) after the writef.
Jul 08 2004
parent reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:ccl6v8$10k9$1 digitaldaemon.com...
 try an fflush(stdout) after the writef.

That works but that way i have to import both std.c.stdio and std.stdio! I think i'll just stick with the writefln (it is really nice by the way!)
Jul 08 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:cclcok$1919$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message
 news:ccl6v8$10k9$1 digitaldaemon.com...
 try an fflush(stdout) after the writef.

That works but that way i have to import both std.c.stdio and std.stdio! I think i'll just stick with the writefln (it is really nice by the way!)

The flush is triggered by the output of '\n' when writing to a 'tty'. I'd just remembered that <g>, which is why the writefln worked for you. The output from writef will eventually appear. In fact, the behavior is the same as if you used a printf without a '\n'.
Jul 09 2004
parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
"Walter" <newshound digitalmars.com> escribiˇ en el mensaje
news:ccmgfa$2usm$3 digitaldaemon.com
| The flush is triggered by the output of '\n' when writing to a 'tty'. I'd
| just remembered that <g>, which is why the writefln worked for you. The
| output from writef will eventually appear. In fact, the behavior is the
same
| as if you used a printf without a '\n'.

What about this?

//////////
import std.date;
import std.stdio;
import std.c.stdio;

void main ()
{
    writefln("hi");
    fflush(stdout);
    d_time t = getUTCtime ();
    while ( getUTCtime() - t < 2 ) {}
    writef("bye");
}

//////////

Both "hi" and "bye" get printed at the same time (2 secs after the program
started). Tested on WinXP Pro and Win95 (yes, I'm currently using also 95).

-----------------------
Carlos Santander Bernal
Jul 09 2004
parent "Walter" <newshound digitalmars.com> writes:
"Carlos Santander B." <carlos8294 msn.com> wrote in message
news:ccn4oq$rbi$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> escribiˇ en el mensaje
 news:ccmgfa$2usm$3 digitaldaemon.com
 | The flush is triggered by the output of '\n' when writing to a 'tty'.

 | just remembered that <g>, which is why the writefln worked for you. The
 | output from writef will eventually appear. In fact, the behavior is the
 same
 | as if you used a printf without a '\n'.

 What about this?

 //////////
 import std.date;
 import std.stdio;
 import std.c.stdio;

 void main ()
 {
     writefln("hi");
     fflush(stdout);
     d_time t = getUTCtime ();
     while ( getUTCtime() - t < 2 ) {}
     writef("bye");
 }

 //////////

 Both "hi" and "bye" get printed at the same time (2 secs after the program
 started). Tested on WinXP Pro and Win95 (yes, I'm currently using also

Windows is a multithreaded operating system, and while your program is hung in a tight loop, it is probably preventing other threads from running, like the thread that updates the console window.
Jul 09 2004
prev sibling parent "Carlos Santander B." <carlos8294 msn.com> writes:
I think this will be fixed when TypeInfo gets better, but right now:

date_t t = /* something */;
writef("%s",t);

Outputs the numeric representation of the date.

-----------------------
Carlos Santander Bernal
Jul 08 2004