c++ - Calling subproject binary with system() function 4 times faster than linking subproject -


i need call subproject main project , implemented 2 ways of doing that. turns out, second way factor 4 slower first. can explain me?

the subproject looks this:

#include "fancyproject.h" int main (int argc, char *argv[]) {   std::string controlfile = argv[1];   return runfancyproject(controlfile); } 

first way: call binary of subproject in main project via system() function:

std::string command = "fancyproject controlfile.dat"; int result = system(command.c_str()); 

second way: create library subproject, link library main project , call specific function:

#include "fancyproject.h" std::string controlfile = "controlfile.dat"; int result = runfancyproject(controlfile); 

in meantime, created minimal example. however, behaves expected: system() function slower call of linked function. thus, error has somewhere else in project. nevertheless thank time, dsboger. further investigations in direction.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -