C runtime library for Unix

K

Keith Thompson

Paul Edwards said:
Your test is inadequate because you wouldn't see the
problem unless you did an fopen() and suddenly your
code got executed by the C library.

Ok, I just tried that, and it worked fine, to my complete lack of
surprise. fopen() opened the file correctly, and strace shows calls
to the system's open() function; the program also called my own open()
function.

You didn't really expect a major implementation to get this wrong, did
you?
 
S

santosh

Paul said:
"Tor Rustad" <[email protected]> wrote in message

Well I didn't know that until you told me just now.

Any other way will cause your CRT to be dependant on another library in
the system, not the way I think that you want it.
Well, not the way I'm doing it. I'm using the published
interface, which means I have coded CreateFile() in my
implementation of fopen(), which means I am polluting
the namespace.

By 'coded' you do mean calling CreateFile() defined in kernel32.dll,
don't you. If so that won't pollute the namespace more than other C
libraries will do.
You're missing the fact that I thought it was a good idea to
use the OS's published interface, at least for Win32 and
OS/2.

That's how it ought to be done. You're not polluting the namespace, the
OS is, and that's a restriction we've got to live with.
And
now I am looking into Unix and wondering what I should
use as the "official interface".

The system call interface exported by the kernel. For the case of Linux
under x86, it's through INT 0x80. Consult the kernel's source and
documentation for details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top