forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Not all the routines in FTN95 are available for .NET?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
yujsg



Joined: 20 Jun 2007
Posts: 15

PostPosted: Tue Jun 26, 2007 11:46 pm    Post subject: Not all the routines in FTN95 are available for .NET? Reply with quote

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
View user's profile Send private message
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Wed Jun 27, 2007 5:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
yujsg



Joined: 20 Jun 2007
Posts: 15

PostPosted: Wed Jun 27, 2007 6:47 pm    Post subject: Reply with quote

Thanks Andrew! I will try the System.IO Namespace.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Jul 06, 2007 3:14 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
yujsg



Joined: 20 Jun 2007
Posts: 15

PostPosted: Fri Jul 06, 2007 3:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
Martin



Joined: 09 Sep 2004
Posts: 43

PostPosted: Sat Jul 07, 2007 12:41 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group