f



Help needed! Fortran Dll works for compaq fortran not for Intel Fortran #2

Dear all,

I am porting a compaq fortran project (version 6.x) over to the intel
fortran compiler (version 8.0). However, crash always happens at the
internal write statement under the intel fortran compiler.

=========
project brief:
=========
The soultion comprises two parts, one is the c++ project, which in charge of
the user interface, the other project is a Fortran Dll project. The Fortran
Dll is invoked by the C++ project. the problem I meet here is every simple,
the C++ project is just a framework of the dialog based mfc win32
application. In the code response to the click OK button, it will invoke the
fortran dll. The Fortran dll is built as the name of TestDll.dll. The core
part of the C++ and Fortran code are shown as follows:


=========
C++ code
=========
....
typedef unsigned int (__stdcall *_FPTR_START_APP) ( void * );
....

 if (nResponse == IDOK)              ////code corresponding to the click OK
button
 {

  CString fileName = "abc";
  m_hSimDLL = LoadLibrary((LPCTSTR)"TestDll");
  FARPROC fPtrStartApp = ::GetProcAddress( m_hSimDLL, "StartApp" );

   void* pvSecurity = NULL;
   unsigned int* puiThrdAddr = NULL;
   m_hThread = (HANDLE) _beginthreadex( pvSecurity, 0,
(_FPTR_START_APP)fPtrStartApp, (void *)(LPCTSTR)fileName.GetBuffer(0), 0,
puiThrdAddr );
....//idle or do something here so that the thread of the fortran Dll will
run and can be debugged.
}

=========
Fortran code
=========
Corresponding Fortran Dll is made of by the following code:

! ---------------------------------------------------------------------
Subroutine StartApp(iAddressStrBuf)

     !DEC$ ATTRIBUTES DLLEXPORT::StartApp
     !DEC$ ATTRIBUTES ALIAS: 'StartApp'::STARTAPP
     !DEC$ ATTRIBUTES VALUE::iAddressStrBuf

    integer iAddressStrBuf
    integer i
    character*32 strTest

    i=555

    write(strTest,'(i10.10)') i
 return
end subroutine StartApp
!----------end of the fortran dll project ----------------------------------

=========
Symnpton
=========
Whenever the internal write statement is invoked, the program will crash and
report the error of access violation occurred.

If there is anyone knows the issue, could you please give me a hand.

=========
Attached
=========
It appears that I can not send the whole project sample files in zip format,
I will send to those who responsed to this email either in person or to the
newsgroup if needed.

Best Regards,

David




0
ixuw (5)
4/8/2004 9:22:49 AM
comp.lang.fortran 11941 articles. 1 followers. Post Follow

0 Replies
761 Views

Similar Articles

[PageSpeed] 28

Reply: