- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2. Does the PATH environment variable include C:Program FilesIntelCompilerFortran9.0IA32Bin ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Look at the caller to
subroutine ExampleDLL(SuccessFlag,iprint,InputFile)
to see what InputFile is

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page