Message Boards Message Boards


Need Help Using a Generic C Compiler for Compile[ ]

Posted 9 years ago
1 Reply
0 Total Likes

I'm trying to use LLVM's Clang compiler for Compile[ ] and running into a problem. The operating system is Windows 8.1 (64 bit) and the Mathematica version is 10.0.2


$CCompiler = {"Compiler" -> GenericCCompiler,
   "CompilerInstallation" -> "C:/LLVM", 
   "CompilerName" -> "clang.exe"};

c = Compile[ {{x, _Real}, {n, _Integer}},
    Module[ {sum, inc}, sum = 1.0; inc = 1.0; 
    Do[inc = inc*x/i; sum = sum + inc, {i, n}]; sum], 
   CompilationTarget -> "C"]

LibraryFunction::libload: The function compiledFunction0 was not loaded from the file C:\Users\Frank\AppData\Roaming\Mathematica\ApplicationData\CCompilerDriver\BuildFolder\hplargedesktop-9156\compiledFunction0.dll. >>

Compile::nogen: A library could not be generated from the compiled function. >>

However, CreateExecutable works with the settings "Compiler" -> GenericCCompiler, "CompilerInstallation" -> "C:/LLVM", "CompilerName" -> "clang.exe"

POSTED BY: Frank Kampas

It looks like the dll created is a 32 bit dll, which is why it can't be loaded.

POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract