简体   繁体   中英

Is it possible to read code of a C++ library and modify it?

A bit of a simple question, though the answer may not be. I am fairly new to C++ and was wondering if it was possible to open a C++ library and see it's code. It sounds like a potentially risky move to accidentally change the core code of the library, but I would still like to see if it is possible. Thank you!

There are too kinds of libraries that C++ can use:

  • compiled to binary libraries which are linked with linker to your
    executable;
  • headers-only libraries which are just included with include into your source code

You can "open" headers of headers-only libraries and modify code if you wish (but not recommended).

Also many compiled libraries are open source. You can open source files there. If you want to modify such library, you will need to compile it and link your executable against this modified version.

Yes it s possible to open a c++ library and see its code.

If you want to make changes to any functionality simply create your own version of it giving it a different name, or if you want to add functionality just simply extend the class you are interested in. (read up on inheritance for this).

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