execute C++ from String variable -


it possible in c++ execute c++ code string variable. in javascript:

var theinstructions = "alert('hello world'); var x = 100";  var f=new function (theinstructions);  return(f()); 

i want similar javascript in c++. how ?

you need invoke compiler compile code. in addition, need generate code wrap string in function declaration. finally, you'll somehow need load compiled code.

if doing (which not) would:

  1. concatenate standard wrapper function header around code
  2. invoke compiler via command line (system()) build shared library (.dll on windows or .so on linux)
  3. load shared library , map function
  4. invoke function

this not way want write c code in cases.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -