Question about running "executables" without source code

In summary: So when you make an executable, you're not just making a program that you can run, you're also making a library that other people can use.
  • #1
ChrisVer
Gold Member
3,378
464
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
  • #2
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 QuantumQuest
  • #3
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.
 

1. Can you explain what it means to run an executable without source code?

Running an executable without source code means executing a program or application without having access to the original source code that was used to create it.

2. Is it possible to run an executable without source code?

Yes, it is possible to run an executable without source code. Many programs and applications are distributed as executables, which means they can be run without the need for the original source code.

3. How do you run an executable without source code?

To run an executable without source code, you simply need to have the appropriate operating system and hardware requirements, and then double-click on the executable file. The program will then run as intended without the need for the source code.

4. What are the limitations of running an executable without source code?

The main limitation of running an executable without source code is that you cannot make any changes or modifications to the program. You are limited to using the program as it was originally created.

5. Are there any security risks associated with running an executable without source code?

Yes, there can be security risks associated with running an executable without source code. If the executable is from an unknown or untrusted source, it could potentially contain malicious code that could harm your computer. It is always important to only run executables from trusted sources.

Similar threads

  • Programming and Computer Science
Replies
0
Views
770
  • Programming and Computer Science
Replies
7
Views
665
  • Programming and Computer Science
Replies
5
Views
851
  • Programming and Computer Science
Replies
14
Views
1K
  • Programming and Computer Science
Replies
2
Views
769
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
2
Views
741
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
9
Views
2K
Back
Top