static bool CallGams(string sysDir) { string msg = string.Empty; int saveEOLOnly; string defFile = sysDir + System.IO.Path.DirectorySeparatorChar + "optgams.def"; if (opt.optReadDefinition(defFile) != 0) { int i, itype = 0; for (i = 1; i <= opt.optMessageCount(); i++) { opt.optGetMessage(i, ref msg, ref itype); Console.WriteLine(msg); } Console.WriteLine("*** Problem reading definition file " + defFile); return(false); } saveEOLOnly = opt.optEOLOnlySet(0); //need to adjust path if executed e.g. in bin\debug opt.optReadFromStr("I=..\\GAMS\\model2.gms lo=2"); opt.optEOLOnlySet(saveEOLOnly); opt.optSetStrStr("sysdir", sysDir); if (gamsx.gamsxRunExecDLL(opt.GetoptPtr(), sysDir, 1, ref msg) != 0) { Console.WriteLine("Could not execute RunExecDLL: " + msg); return(false); } return(true); }