View previous topic :: View next topic |
Author |
Message |
yujsg
Joined: 20 Jun 2007 Posts: 15
|
Posted: Tue Jun 26, 2007 11:46 pm Post subject: Not all the routines in FTN95 are available for .NET? |
|
|
I am writing an FTN95 .NET DLL. I found in the user's manual that "readf@" is currently only available for Win32. I tried to call it in my .NET DLL. It gives me "An unhandled exception of type 'System.InvalidProgramException' occurred" error. It worked perfectly in my Win32 DLL. Is there any other routine to call for performing the same task in .NET? When will be the new version, in which all the routines in FTN95 are available for .NET, to be released? Thanks. |
|
Back to top |
|
|
Andrew
Joined: 09 Sep 2004 Posts: 232 Location: Frankfurt, Germany
|
Posted: Wed Jun 27, 2007 5:36 pm Post subject: |
|
|
readf@ is a Win32 specific routine that uses the Win32 API to achieve its business - it is not of course standard Fortran. This routine will not be ported to .NET. An alternative using .NET would be to use the routines that the .NET libraries provide, you can find these in the System.IO namespace for file operations and will have to use .NET extensions to call them. |
|
Back to top |
|
|
yujsg
Joined: 20 Jun 2007 Posts: 15
|
Posted: Wed Jun 27, 2007 6:47 pm Post subject: |
|
|
Thanks Andrew! I will try the System.IO Namespace. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri Jul 06, 2007 3:14 pm Post subject: |
|
|
READF@ should work although it is not portable to other operating systems. The following code runs OK for me under .NET...
integer(2) handle, error_code
integer(3) nbytes, bytes_read
character(512) buffer
buffer = "READF@ failed"
call OPENR@("data.txt",handle,error_code)
print*, error_code,handle
nbytes = 1000
call READF@(buffer, handle, nbytes, bytes_read, error_code)
print*, error_code,bytes_read
call CLOSEF@(handle, error_code)
print*, error_code
print*, buffer(1:64)
end
There is a problem with OPENF@ under .NET which we will investigate. |
|
Back to top |
|
|
yujsg
Joined: 20 Jun 2007 Posts: 15
|
Posted: Fri Jul 06, 2007 3:30 pm Post subject: |
|
|
Thanks Paul. It also worked for me when I used it to read characters. But it gave errors in .NET, when I tried to use it to read integer values which were saved in binary format. |
|
Back to top |
|
|
Martin
Joined: 09 Sep 2004 Posts: 43
|
Posted: Sat Jul 07, 2007 12:41 am Post subject: |
|
|
The readf@ and related routines have been ported to .NET and should also be cross platform (although they probably haven't been tested on other systems for a while).
The System.InvalidProgramException could be caused by a bug. If you can supply us with (ideally as short as possible) example code so we can reproduce the issue we will take a look at it. |
|
Back to top |
|
|
|