Created
April 22, 2017 15:17
-
-
Save mmn80/387eb7a335da6160f52d39ce02881bd4 to your computer and use it in GitHub Desktop.
Export control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CPP | |
import System | |
%language ElabReflection | |
%language TypeProviders | |
export | |
testFn : Int -> String | |
testFn x = "testFn: " ++ show x | |
mkName : IO (Provider String) | |
mkName = do | |
Right v <- readFile "version.txt" | Left e => pure (Error $ show e) | |
--Just v <- getEnv "PATH" | _ => pure (Error "ERR") | |
pure (Provide $ "testFn_v" ++ (trim v)) | |
%provide (fnName : String) with mkName | |
mkFnName : Elab () | |
mkFnName = do | |
fill (RConstant fnName) | |
solve | |
exports : FFI_Export FFI_C "exports.h" [] | |
exports = Fun testFn (%runElab mkFnName) $ End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment