私は、アプリケーションMathLink
から独立したmma式を文字列として送受信するために使用します。C++
std::string expression[N];
// ...
for(int i = 0; i < N; ++i) {
MLPutFunction(l, "EnterTextPacket", 1);
MLPutString(l, expression[i].c_str());
MLEndPacket(l);
// Check Packet ...
const char* result;
MLGetString(l, &result);
// process result ...
MLDisownString(l, result);
}
MLDisownString
使用済みのメモリは解放されないことを除いて、解放されると思います。
何か案は?