Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. FunctionCompileExportLibrary["function.dll", Function[
  2. Typed[arg, "MachineInteger"], arg + 1]]
  3.  
  4. lib = FunctionCompileExportLibrary["function.dll",
  5. Function[Typed[arg, "MachineInteger"], arg + 1],
  6. "CompilerOptions" -> "CreateLibraryOptions" ->
  7. {"SystemLibraries" -> {"WolframRTL_Static_Minimal"}}];
  8.  
  9. Needs["CCompilerDriver`"]
  10.  
  11. test = CreateExecutable["
  12. #include <stdio.h>
  13. #include <inttypes.h>
  14. int64_t Main(int64_t);
  15. int main() {
  16. printf("%" PRId64, Main(10));
  17. }",
  18. "test", "Libraries" -> {FileNameJoin[{$CCompilerDefaultDirectory, "function.lib"}]}];
  19.  
  20. RunProcess[test, "StandardOutput"]
  21.  
  22. (* "11" *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement