diff --git a/libs/console/piterminal.cpp b/libs/console/piterminal.cpp index 452c473b..623e09be 100644 --- a/libs/console/piterminal.cpp +++ b/libs/console/piterminal.cpp @@ -817,7 +817,7 @@ bool PITerminal::initialize() { memcpy(argv[0], shell.data(), shell.size()); argv[0][shell.size()] = 0; argv[1] = 0; - execvp(shell.data(), argv); + execvp(argv[0], argv); delete[] argv[0]; delete[] argv; exit(0); diff --git a/libs/main/system/piprocess.cpp b/libs/main/system/piprocess.cpp index d4d2e621..6faf7b5e 100644 --- a/libs/main/system/piprocess.cpp +++ b/libs/main/system/piprocess.cpp @@ -202,7 +202,7 @@ void PIProcess::startProc(bool detached) { #else //cout << "exec " << tf_in << ", " << tf_out << ", " << tf_err << endl; - if (execve(str.data(), argscc, envcc) < 0) + if (execve(str.data(), (char * const *)argscc, (char * const *)envcc) < 0) piCoutObj << "\"execve" << str << args << "\" error :" << errorString(); } else { piMinSleep; diff --git a/main.cpp b/main.cpp index a247a89b..f6d084b6 100644 --- a/main.cpp +++ b/main.cpp @@ -1,89 +1,114 @@ #include "pip.h" -REGISTER_VARIANT_TYPEINFO(PIVector) +static const char * smallstr = "abcdef"; -PIEthernet eth; - -class OH: public PIObject { - PIOBJECT(OH) -public: - EVENT_HANDLER0(void, eh0) { - piCout << "eh0"; - } - EVENT_HANDLER1(void, eh1, PIStringList, sl) { - piCout << "eh1" << sl; - } - EVENT_HANDLER2(void, eh2, PIStringList, sl, const PIVector< double > &, vd) { - piCout << "eh2" << sl << vd; - } - EVENT_HANDLER3(void, eh3, PIStringList, sl, const PIVector &, vd, PISystemTime, st) { - piCout << "eh3" << sl << vd << st; - } -private: - int cnt = 0; -}; - -class OE: public PIThread { - PIOBJECT_SUBCLASS(OE, PIThread) -public: - EVENT0(e0); - EVENT1(e1, PIStringList, sl); - EVENT2(e2, PIStringList, sl, PIVector< double>, vd); - EVENT3(e3, PIStringList, sl, PIVector< double>, vd, PISystemTime, st); -private: -}; - -PIThreadNotifier notifier; -PITimeMeasurer time; - -class Worker: public PIThread { - PIOBJECT_SUBCLASS(Worker, PIThread) -public: - Worker(const PIString & n) { - setName(n); - } - void run() override { - piCoutObj << (int)time.elapsed_m() << "wait ..."; - notifier.wait(); - piCoutObj << (int)time.elapsed_m() << "done"; - }; -}; +static const char * bigstr = "zsxdcgfhvbncjdbasljcvavcjadnwnxudvbabdhjlavudvdaljsvclavjlasdhvcjhldsavhjldasvfjlhsavdjhavdjhvfjhldasvfjlasvfhjldasvfhjasvfdjdasfhvjldasvhfjlasvfhjlahsvdfhjfvfvdjalsvfjlhasdvfdjsalvfhhjldasvfdjhaldsvfhjdvsfjhlavfjhlavfladlsvfjlasdvfdhjlavfhjldasvfhjlavfhjldvfhjlalsdvfjlhvasfhjlvchjlavchjladvchjldladvschjlladscvjlhdcahjchjllcahjllvcdjladsvhldbcljadsbcjdhlsachjlvdsa hjlcldajc hljdascbhaldb cldhashd l cajlhs chdsbfhlbfdasdffadsfjkbfkjldsabflhbcldhsbhclabchljadsbchldahsbcladsbhclhabhasbclasbdhl"; int main(int argc, char * argv[]) { - typedef int(*MyFunc)(int,int); - PILibrary * lib = new PILibrary(); - if (lib->load("libpip_plugin.dll")) { - MyFunc fadd = (MyFunc)lib->resolve("exportedSum"); - MyFunc fmul = (MyFunc)lib->resolve("exportedMul"); - if (fadd) { - int sum = fadd(1, 2); - piCout << "sum =" << sum; - } else { - piCout << "Can`t resolve" << "exportedSum"; - } - if (fmul) { - int mul = fadd(10, 20); - piCout << "mul =" << mul; - } else { - piCout << "Can`t resolve" << "exportedMul"; - } - } else { - piCout << lib->lastError(); + static const int cc = 1000000; + PITimeMeasurer tm; + int l = 0; + tm.reset(); + for(int i=0; i