- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
An unhandled exception of type 'System.DllNotFoundException' occurred in ExampleDLLcall.exe Additional information: Unable to load DLL (F:Studio NETTCAT DLL TestExampleDLLDebugExampleDLL.dll)
This is the vb code:
Friend Declare Auto Sub ExampleDLL _ Lib "F:Studio NETTCAT DLL TestExampleDLLDebugExampleDLL.dll" _ (ByRef SuccessFlag As Boolean, ByRef iPrint As Integer, ByVal FilePath As String, ByVal StringLength As Integer) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SuccessFlag As Boolean = False Dim MatNum As Integer = 0 Dim iPrint As Integer = 0 Dim FilePath As String = "F:Documentsinputs.in" Dim StringLength As Long = Len(FilePath) ' call dll Call ExampleDLL(SuccessFlag, iPrint, FilePath, StringLength) End Sub
And this is the fortran code:
subroutine ExampleDLL(SuccessFlag,iprint,InputFile) ! Expose subroutine ExampleDLL to users of this DLL ! !DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE::ExampleDLL !DEC$ ATTRIBUTES ALIAS : "ExampleDLL" :: ExampleDLL ! Variables ------------------------------------- implicit none ! determines success of tcat program execution logical(2),intent(inout):: SuccessFlag integer,intent(inout):: iprint logical(2):: TCAT2flag CHARACTER(*),intent(in):: InputFile integer:: matnum ! Body of ExampleDLL ------------------------------ ! set success flag to false SuccessFlag = .false. ! read from file open(unit=10,file=InputFile,status='old') read(10,*) matnum !/number of materials close(10) iprint = matnum ! change the internal variable TCAT2flag = .true. ! pass result to output variable SuccessFlag = TCAT2flag end subroutine ExampleDLL
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
2. Does the PATH environment variable include C:Program FilesIntelCompilerFortran9.0IA32Bin ?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Download Dependency Walker and analyze your DLL with it. Make sure that all DLLs it identifies are available on one of the folders in PATH.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Thanks for the suggestion.
I followed your advice. I placed the file in the active directory (the default one shown in the message). However, it still didn't work. So insead, I changed the current active directory to one with a shorter path string and instead of reading from a file i tried to write this time. There was no error, but i discovered thatwhen i pass thestring variable (the path of the file to read) to the Fortran dll, it is only thefirst letter that it used in the open statement. Hence, instead of'inputs.in' it is using just 'i'.
I must be doing something wrong when i passthestringvariable tothe fortran dll?
Either way, thank you for your constant help.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Look at the caller to
subroutine ExampleDLL(SuccessFlag,iprint,InputFile)
to see what InputFile is
