KR383: My UDF compiles in Linux, but I cannot compile it in Windows. Why?


This behavior is mostly due to the fact the Visual C++ compiler is stricter with non-standard C features than the gcc compiler used in Linux. In particular, the most commonly (mis)-used extension is the presence of executable statements before all declarations. Hence while


DEFINE_ON_DEMAND(show_difference)
{
Message(`This is an executable statementn`);
real x = 5;
Message(`The value of x is %fn`, x);
}

compiles and behaves as expected in Linux, the windows compiler produces an error. Converting this to


DEFINE_ON_DEMAND(no_difference)
{
real x = 5;
Message(`This is an executable statementn`);
Message(`The value of x is %fn`, x);
}


will allow it to be compiled and run on both platforms.





Show Form
No comments yet. Be the first to add a comment!