2013-10-01 3 views
0

C# API를 통해 대화 형 중개인에 연결하려고합니다. 연습으로 F #에서 클라이언트를 개발하려고합니다.f #에서 C# 라이브러리 사용 #

이 내가 한 일입니다 : 내가 비주얼 스튜디오에서 CSharpAPI 프로젝트를 가져온

  1. . CSharpAPI가 IBApi 네임 스페이스를 정의합니다.
  2. 솔루션에 새 F # 프로젝트를 만들었습니다. 이 프로젝트는 내가 아래와 같이 .fs 파일에서 새 모듈을 생성
  3. 내 구현을 개최한다 :

    open IBApi 
    
    module ibConnectivity = 
    
        type IBclient = 
         interface EWrapper with 
         member this.connectionClosed() = printfn "connection has been closed" 
         member this.currentTime time = printfn "server time: %i" time 
    .... 
    

나는 다음과 같은 오류 메시지가 얻을 :

오류 1 개 파일을 라이브러리 또는 다중 파일 응용 프로그램은 네임 스페이스 또는 모듈 선언과 함께 을 시작해야합니다. '네임 스페이스 SomeNamespace.SubNamespace'또는 '모듈 SomeNamespace.SomeModule'

가 나는 해결책 주위를 봤있다. 나는 완전한 멍청한 놈이다. 일부 게시물은 F # 파일 순서를 참조하지만이 경우에는 C# 라이브러리로 작업하고 있습니다.

답변

0

이것은 파일이 namespace 또는 module 선언으로 시작되어야 함을 의미합니다. 이 같은

module ibConnectivity 

open IBApi 

type IBclient = 
    interface EWrapper with 
    member this.connectionClosed() = printfn "connection has been closed" 
    member this.currentTime time = printfn "server time: %i" time 

구문 module Name = <indented declarations> 파일의 상단 선언 모듈 또는 공간 내에 서브 모듈을 선언하는 데 사용된다.