2012-10-20 3 views
2

나는 FFI를 사용하여 C 함수에 바인딩하는 모듈을 가지고있다. 이 모듈을 doctest으로 사용하려면 어떻게해야합니까?하스켈 doctest와 FFI

ByteCodeLink: can't find label 
During interactive linking, GHCi couldn't find the following symbol: 
    bar 
This may be due to you not asking GHCi to load extra object files, 
archives or DLLs needed by your current session. Restart GHCi, specifying 
the missing library using the -L/path/to/object/dir and -lmissinglibname 
flags, or simply by naming the relevant files on the GHCi command line. 
Alternatively, this link failure might indicate a bug in GHCi. 
If you suspect the latter, please send a bug report to: 
    [email protected] 

### Failure in Foo.hs:41: expression `foo' 
expected: [42] 
but got: 
      <interactive>:24:1: Not in scope: `bar' 
Examples: 2 Tried: 2 Errors: 0 Failures: 1 
+1

doctest 문서에 따르면 원하는 GHC 플래그를 전달할 수 있습니다. 오류의 지침에 따라 시도해 보셨습니까? 더 구체적인 도움이 필요하다면 문제를 재연 할 수있을 정도로 코드를 보여줘야합니다. –

답변

2

doctest가 임의 GHC 플래그를 허용합니다

doctest Foo.hs를 실행할 때 내가 오류는이 같은 것입니다. Doctest를 FFI 코드와 함께 실행하려면 해당 코드로 GHCi 세션을 실행하는 데 필요한 동일한 플래그를 전달해야합니다. 예 : Doctest driver of unix-time을 살펴보십시오.