Use another language to call a function: Difference between revisions

m
Line 792:
}</lang>
 
Compile interface to a library: ''gcc -O2 -Wall -fPIC -shared query.c -o libquery.so -lpari''
 
Compile main() C code from above and link against this library: ''gcc -O2 -Wall main.c -o main -L. libquery.so ''
 
Start main(): ''LD_LIBRARY_PATH=. ./main''
 
PARI solves the ROT13 encrypted message and returns result to caller.
 
Output:<pre>Here I am</pre>
 
NB. It's also possible to compile both files together without building an interface: ''gcc -O2 -Wall main.c query.c -o main2 -lpari''
 
''./main2'' yields same output as stated above.
 
=={{header|Pascal}}==
Anonymous user