This tutorial explains how to use the createVRMLFromString interface of the browser object. (sources: cppscript2.cpp, cppscript2.wrl. To view this example load the cppscript2.wrl file with the glutCyberle VRML-Browser. The script can be compiled as explained in the cppscript tutorial.
MFNode* erg = pParams->browser->CreateVrmlFromString(str.c_str());This function returns an MFNode field, which is allocated by the browser. Therefore the browser also must deallocate it.
pParams->browser->Dealloc(erg);
//Save the node reference to be able to remove it later const SFNode* node = erg->at(0); pParams->browser->IncNodeRefCount(node); DATA(nodes).push_back(node);Similar, if you don't need the reference to the SFNode object anymore, dec the reference counter.
pParams->browser->DecNodeRefCount(DATA(nodes)[i]);