更新时间:2022-06-01 02:30:21
是,当然,在其他答案中提到没有任何工具,但只需使用C ++编译器
Yes, of course, without any tools mentioned in the other answers, but simply using the C++ compiler.
只需在您的C ++程序中执行这些步骤(在linux上,但在其他操作系统上必须类似)
just follow these steps from within your C++ program (on linux, but must be similar on other OS)
ofstream
system(c ++ /tmp/prog.cc -o /tmp/prog.so -shared -fPIC);
dlopen()
ofstream
system("c++ /tmp/prog.cc -o /tmp/prog.so -shared -fPIC");
dlopen()