Question about running "executables" without source code

Click For Summary
SUMMARY

This discussion centers on the ability to hide source code and class structures in programming languages like C++ and Python. It confirms that while C++ allows for encapsulation through access specifiers (private, public, protected), complete concealment of classes from users is not feasible due to the nature of compiled binaries. The transformation of source code into binary executables involves compilers that optimize and convert high-level code into assembly language, making reverse engineering challenging but not impossible. Additionally, Python's interpreted nature complicates the creation of standalone executables, as they often require external libraries and interpreters.

PREREQUISITES
  • Understanding of C++ access specifiers (private, public, protected)
  • Familiarity with the compilation process of programming languages
  • Knowledge of binary executables and assembly language
  • Basic concepts of Python and its dependency management
NEXT STEPS
  • Research C++ compiler optimization techniques
  • Learn about reverse engineering tools for analyzing binary executables
  • Explore methods for creating standalone Python executables using tools like PyInstaller
  • Study the role of dynamic and static libraries in software development
USEFUL FOR

Software developers, particularly those working with C++ and Python, as well as anyone interested in software distribution and code protection strategies.

ChrisVer
Science Advisor
Messages
3,372
Reaction score
465
I have a simple question I guess, basically by how classes etc are formed. In general a class in C++ has some categories such as private, public and protected, which okay everyone knows/can find what they are meant for. E.g. a private member will not be accessible outside the class member functions. My question is then, is it possible to completely hide it from the user then? Or even hide the whole class if you don't want them to "play around" with it?
As an example, my question is related to the intermediate step between having a source code which runs and produces executables from the programmer, and the application which is publicly distributed. When I install a game X, I am unable to see the code which actually built it and runs behind the scene [except maybe for if I am a cheater or something]. what happened to it? In the past I had tried sending to a friend just the executable of a fun project I made [with python in that case], but she was unable to run it without the code- however I didn't want to send the code which would need more stuff from her side to run [e.g. download the necessary interpreter, modules etc] but also because it would make the project easy to change by the user.
 
Technology news on Phys.org
ChrisVer said:
I have a simple question I guess, basically by how classes etc are formed. In general a class in C++ has some categories such as private, public and protected, which okay everyone knows/can find what they are meant for. E.g. a private member will not be accessible outside the class member functions. My question is then, is it possible to completely hide it from the user then? Or even hide the whole class if you don't want them to "play around" with it?
These are high level constructs. It is possible to reverse engineer some things, like figuring out algorithms, by looking at executables, but I would be very surprised if someone could recover object-oriented constructs.

ChrisVer said:
As an example, my question is related to the intermediate step between having a source code which runs and produces executables from the programmer, and the application which is publicly distributed. When I install a game X, I am unable to see the code which actually built it and runs behind the scene [except maybe for if I am a cheater or something]. what happened to it?
The code was transformed into a binary executable, which involved a compiler going many times through some high-level code and mangling it into a series of assembly language instructions, including some optimization. One can disassemble the binary to get back assembly code, but figuring out what it is doing is going to be hard.

ChrisVer said:
In the past I had tried sending to a friend just the executable of a fun project I made [with python in that case], but she was unable to run it without the code- however I didn't want to send the code which would need more stuff from her side to run [e.g. download the necessary interpreter, modules etc] but also because it would make the project easy to change by the user.
Python is not really a compiled language, isn't it? Also, compiled programs may rely on outside code found in libraries. Make an executable doesn't necessarily mean making something that is stand-alone.
 
  • Like
Likes   Reactions: QuantumQuest
That's what a library is. You know how if you want to talk to a database, you #include <mysql.h>, but if you look at mysql.h, it's just a list of functions with no actual code? That's because that's the public interface for what is behind the scenes a very complicated piece of software. That's because you also have to link mysql.lib. This .lib file (can also be .dll, .so, .a) is a precompiled library. It means the original source was compiled with a public interface, and you can use it as though it were just more code.
 

Similar threads

Replies
3
Views
2K
Replies
7
Views
3K
  • · Replies 0 ·
Replies
0
Views
3K
Replies
7
Views
4K
Replies
5
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 29 ·
Replies
29
Views
4K