ใน Rtools จะมี compiler ของ gcc (mingw) มาด้วยแล้วทั้งที่เป็นแบบ 32 bits และ 64 bits หากอยากจะเอาไปใช้ใน Mathematica ก็ต้องเรียกผ่าน CCompilerDriver`GenericCCompiler` ครับ แล้วเพียงเซ็ต Path ของ gcc จาก Rtools นี้ให้ถูก เช่น
Needs["CCompilerDriver`GenericCCompiler`"]
ทดลองเรียกใช้งาน
greeter = CreateExecutable[StringJoin[ "#include <stdio.h>\n", "int main(){\n", " printf(\"Hello MinGW-w64 world.\\n\");\n", "}\n"], "helloworld", "Compiler" -> GenericCCompiler, "CompilerInstallation" -> "C:/Rtools/mingw_64", "CompilerName" -> "x86_64-w64-mingw32-gcc.exe"] Import["!\""<>greeter<>"\"","Text"] Hello MinGW-w64 world.
ที่นี้ถ้าอยากจะให้ Mathematica มันเรียกใช้เจ้า mingw 64 จาก Rtools นี้ตลอด อย่างเช่นคำสั่ง Compile ก็สามารถทำได้โดยเซ็ตค่าที่มันเกี่ยวข้องอย่างเช่น Path กับตัวแปร $CCompiler ได้เลยครับ
$CCompiler = {"Compiler" -> GenericCCompiler, "CompilerInstallation" -> "C:/Rtools/mingw_64", "CompilerName" -> "x86_64-w64-mingw32-gcc.exe"}; f = Compile[{x, y}, Sqrt[x^2 + y^2], CompilationTarget -> "C"] Table[{x, f[x, 5/4 x]}, {x, 0, 6, 0.5}]