Is it possible to change my server code without having to compile?

Asked

Viewed 93 times

1

Well I was thinking of something, I have a program that is hosted on linux and through an executable, my clients have access, every modification I do in the server code I have to compile again to take effect, it makes it impossible for my clients to connect, depending on the maintenance time, it takes about 4 hours, so I was thinking, is it possible for me to do some way to change the server code and the updates take effect with the logged in clients?

  • Can’t you compile the program without pausing your server? Or compile it on another computer and just upload the executable? You’d only need to pause to trade one executable for the other.

  • What exactly does this server do with clients and what clients do with the server?

2 answers

1

To compilation of a program C/C++ involves three main steps: pré-processador, compilação and linkagem

  • Preprocessor:

The preprocessor is the first step of the compilation, it examines the written source program and performs certain modifications, based on the compilation directives.

  • Joins lines that have been separated by exhaust sequences.
  • Removes comments and replaces them with blanks
  • Expands macros
  • Processes pre-processing directives

Therefore, the preprocessor modifies the source program, which would not yet be ready to be delivered to compiler.

  • Compiler:

The compiler processes the result of preprocessor and for each unit compilation generates an object file. it consists of checking that the code is well built according to the grammar of language. After verifying that there is no error syntactic or semantic it can already generate the code in machine language.

  • Linkage:

Finally, after preprocessing, compile each source file and generate all the object files we can invoke the Linker. The Linker is responsible for bringing together all the object files and generating the executable file(can also be used to generate dynamic libraries such as dlls).

With the data obtained above, we have the knowledge of how to compile works and how the executable file is generated, and with that baggage acquired we realize that Unable to change an executable code without the compilation.

What you may be doing is setting a time for MAINTENANCE on your daily server, so always at this time the clients would be disconnected and updates would be made!

1

So what’s happening, my friend, is that you’re using the wrong dynamic for your server.

To answer your first question, no - there is no way to do this without compiling because C is not a scripting language. Precisely why most servers use either PHP or (lately) Python.

If you continue to use C, it is recommended that you use a kind of feature tree (e.g., the program loads multiple Dlls and runs each with its own feature), thus saving time to change the server. It is explicit that there are several ways to approach the case and, indeed: C is not the best option for a server that will be changed all the time. Even so, as the subject is vague, I leave so my tip.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.