How one can avoid unnecessary code for file I/O?

Thomas Doerfler Thomas.Doerfler at imd-systems.de
Tue Dec 18 13:04:44 UTC 2001


Hello Leon,

one idea from me: 

Try to examine the vfprintf function from your 
library. I have looked into the code, sprintf 
supplies sort of a dummy FILE structure when 
calling vfprintf, so vfprintf thinks it always 
works on a file.  vfprintf seems to call at least 
"fflush" and maybe some other I/O functions in 
some cases (not in yours). 

So in your case it would be sufficent to supply 
your private "fflush" function (that would maybe 
panic when it would ever be called). Maybe this 
would satisfy the linker...

Hope this helps,
	Thomas.

> Hello, all	.
> 	Sorry to ask the question, which was, as far as I remember, once asked. But 
> I was not able to find it in our mail list, as there is no search capability.
> 	My project has no system I/O capabilities and tight memory requirements. 
> Therefore I am forced to cut out all unnecessary code, such as filesystem, 
> console stuff, etc.
> 	Everything went fine till I tried to use the sprintf function, which 
> immediately pulls a lot of file I/O stuff from libc, libc_support and so on. 
> Then it looks also for rtems_filesystem_... and all the Co. But all I wanted 
> was to produce a string according to my format!! 
> 	I know, that sprintf calls vfprintf and so on...but...
> 	Does somebody know the simple way to solve this problem and not to write my 
> own sprintf?
> 	Many thanks ahead.
> 
> LP 
> leonp at plris.com

--------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler           Herbststrasse 8
D-82178 Puchheim          Germany
email:    Thomas.Doerfler at imd-systems.de
PGP public key available at: http://www.imd-
systems.de/pgp_key.htm




More information about the users mailing list