简体   繁体   中英

how to check c standard library function source code in eclipse

I'm currently learning c and want to know how a standard library function is implemented eg

在此处输入图片说明

I control click ed on the fgets function and it took me to the function prototype declaration of fgets in stdio.h header file.

在此处输入图片说明

But I want to see how fgets is implemented, not its function prototype. Is there anyway to see its internal implementation?

The source code for some standard library implementations, such as glibc , are available online, and you can look up its fgets() code . But the source code isn't typically installed on a development PC unless you're building your own toolchain for some reason (eg, a cross-compiler). In fact, portions of the source code are often written in assembly. Only the compiled object files are usually installed on development / target PCs. Therefore, your IDE doesn't have access to the source and can't show it to you. Other standard libraries like Microsoft's MSVCRT are proprietary and the source code is not available, only the compiled library. You can always disassemble that of course, but the output is not likely to be very useful to you.

In general most (not all!) C/C++ programmers treat standard library functions as black boxes and rely on good reference documentation to understand their behavior.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM