Changes

Jump to navigation Jump to search
27 bytes added ,  18:12, 22 September 2016
L3 -> L2 headers, some rephrasing
Line 15: Line 15:  
that should be present in your code. The <code>arg_p</code> and <code>arg_s</code> is the binary argument that will get delivered to parasite code by complel <code>_start()</code> call (see below). Sometimes this binary argument can be treated as CLI arguments argc/argv.
 
that should be present in your code. The <code>arg_p</code> and <code>arg_s</code> is the binary argument that will get delivered to parasite code by complel <code>_start()</code> call (see below). Sometimes this binary argument can be treated as CLI arguments argc/argv.
   −
=== Compiling and packing ===
+
== Compiling and packing ==
    
Take the program and compile it with compel flags:
 
Take the program and compile it with compel flags:
Line 39: Line 39:  
Now, the <code>foo.compel.o</code> is ready for remote execution (note that <code>foo.o</code> was not).
 
Now, the <code>foo.compel.o</code> is ready for remote execution (note that <code>foo.o</code> was not).
   −
=== Execute the code ===
+
== Running ==
    
Using CLI, the compiled and packed parasite code can be executed like this:
 
Using CLI, the compiled and packed parasite code can be executed like this:
Line 57: Line 57:  
These library calls require binary argument that is copied into the parasite context and is available from it via arg_p/arg_s pair. When run from CLI, the arguments are packed in the usual way (argc/argv).
 
These library calls require binary argument that is copied into the parasite context and is available from it via arg_p/arg_s pair. When run from CLI, the arguments are packed in the usual way (argc/argv).
   −
=== Communicate to parasite code ===
+
== Communicating ==
   −
There are several ways for doing this.
+
There are several ways to pass parameters to the parasite code.
    
If you run the parasite binary from CLI, the command line arguments after <code>--</code> are passed into the parasite's <code>main()</code> function.
 
If you run the parasite binary from CLI, the command line arguments after <code>--</code> are passed into the parasite's <code>main()</code> function.
Line 67: Line 67:  
</pre>
 
</pre>
   −
In <code>main()</code>, common argc and argv can be accessed using the following code:
+
In <code>main()</code>, the standard <code>argc</code> and <code>argv</code> can be obtained using the following code:
    
<source lang="C">
 
<source lang="C">

Navigation menu