2011-12-14 9 views
1

MATLAB .Net Builder을 사용하여 .NET 라이브러리를 생성했습니다. 나는 C#에서 문제없이 사용할 수 있었지만, 이제 F # Interactive에서 만든 빠른 F # 래퍼를 사용하여 몇 가지 테스트를 시도하고 있습니다.MWArray.dll을 F # Interactive에 바인딩 할 수 없습니다.

문제는 F # Interactive에서 MWArray 클래스를 사용할 수없는 것 같습니다.

#r 명령을 사용하여 DLL을 참조 할 수 있었지만 open 명령 뒤에 intellisense를 사용할 때 MathWorks 도메인을 찾을 수 없습니다.

Binding session to 'C:\Program Files\mypath\bin\Debug\MWArray.dll'...

난 정말이에서 오는 아무 생각이없고

error FS0193: internal error: Could not load file or assembly 'file:///C:\Program Files\mypath\bin\Debug\MWArray.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. System.IO.FileNotFoundException: Could not load file or assembly 'MWArray, Version=2.11.0.0, Culture=neutral, PublicKeyToken=e1d84a0da19db86f' or one of its dependencies. The system cannot find the file specified. File name: 'MWArray, Version=2.11.0.0, Culture=neutral, PublicKeyToken=e1d84a0da19db86f' (...) at [email protected]() in C:\Program Files\mypath\ScriptTest.fsx:line 49

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stopped due to error

다음 : 내 코드를 실행하면 흐름이 MWArray가 발생하면

또한, 나는 다음과 같은 오류가 발생합니다 문제를 해결하는 방법.

F #에서 MATLAB .Net 라이브러리를 사용하는 데 성공한 사람이 있습니까?

내 문제를 해결할 수있는 제안이 있으십니까?

답변

2

MatLab 및 .NET interop에 익숙하지 않지만 아키텍처를 확인 했습니까? 즉, 64 비트 DLL을 32 비트 프로세스로로드하거나 그 반대로로드하려고 시도하지 않아야합니다. 또한 P/Invoke 호출을 네이티브 어셈블리로 만드는 관리되는 어셈블리를로드하는 경우 해당 네이티브 DLL은 현재 FSI 세션이 실행되는 디렉터리에 있어야합니다. System.Environment 클래스의 CurrentDirectory 속성을 통해이 값을 확인하고 설정할 수 있습니다.

0

나는 F 번호의 -interactive에 대해 잘 모르겠지만, 난 그냥 ... MWArray.dll 내가 matlab에 NE 빌더 컴파일 된 MATLAB 함수를 사용하는 아주 기본적인 F # 3.0 콘솔 응용 프로그램을 관리해야

open makesquare 
open MathWorks.MATLAB.NET.Arrays 
[<assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")>] 
do() 

[<EntryPoint>] 
let main argv = 
    let stuff = new MLTestClass() 
    let numArray = new MWNumericArray(5) 
    let res = stuff.makesquare(1, numArray) 
    let res_val = res.GetValue(0) 
    printfn "%A" res_val 
    System.Console.ReadKey() 
    0 // return an integer exit code 

makesquare 함수 .NET과 C#으로 유사한 솔루션은이 가이드 http://www.mathworks.se/help/dotnetbuilder/ug/create-a-net-component-from-matlab-code.html

제 단지 간단한 함수 4. + : use .net 2.0 dll in .net 4.5 project (vshost crashes on debug)

관련 문제