PDA

View Full Version : Compact framework


cubud
06-04-2004, 04:25 PM
Hi all

Does the Lahey Fortran.NET compiler work on the compact framework? I have a small sample app which works fine in .NET, but the exact same code doesn't work on WinCE. It throws an exception

"System.NotSupportedException"

tzeis
06-04-2004, 07:47 PM
We don't claim to support the Compact Framework, however, we have been able to create some apps that will run on the C.F. Don't try any Fortran I/O, and pass data through class fields not through procedure arguments. Make sure any Framework methods you call are supported by the C.F.

cubud
06-04-2004, 09:19 PM
We don't claim to support the Compact Framework, however, we have been able to create some apps that will run on the C.F. Don't try any Fortran I/O, and pass data through class fields not through procedure arguments. Make sure any Framework methods you call are supported by the C.F.

Hi

My problem is that the routine I am using absolutely must be able to read a number of files from it's local folder, and to also create a single local file and write to it.

Is this currently not possible?

If not, do you intend to make it possible, because Fortran.NET is only of potential interest to me to enable me to create a hand-held version of a Windows application I already have (which compiles the Fortran code to a Win32DLL using the Watcom compiler).

Pete

tzeis
06-05-2004, 07:23 PM
Doing this might be possible if you use Framework methods in the System.IO namespace rather than doing Fortran I/O. Please let us know if you have any success.

cubud
06-05-2004, 08:16 PM
Doing this might be possible if you use Framework methods in the System.IO namespace rather than doing Fortran I/O. Please let us know if you have any success.

Hi

I *really* cannot change this particular Fortran routine. Doing so would make me legally responsible for all kinds of nasty things, and I really don't want that.

Couldn't the fortran compiler remap the IO to System.IO?

Pete

tzeis
06-07-2004, 10:16 PM
Unfortunately, changes like this will not be occuring in any time frame that will be useful to you.

cubud
06-08-2004, 05:20 PM
Unfortunately, changes like this will not be occuring in any time frame that will be useful to you.

NOOOOOOOO!!!!!!!!!

This is the only thing stopping me from implementing a mobile version of an application I have written for Win32. If begging would help I would *certainly* do it :) Seriously, your compiler was wonderful, I don't even know Fortran yet I was able to compile Win32 DLL code into a .Net assembly without changing a single line of code and then run it from a C# app. I just need to make it work on the compact framework too.

Out of curiousity, how would I change the following code to use System.IO?

OPEN (UNIT=UNITIN, FILE=INFILE, STATUS='OLD')
STATUS = 'DO NOT READ'
46 READ (UNIT=UNITIN,FMT=10000) KEYWRD
IF (KEYWRD.NE.'&data') GOTO 46
KEYWRD = ' '

READ (UNIT=UNITIN,FMT=*)
READ (UNIT=UNITIN,FMT=*)
READ (UNIT=UNITIN,FMT=*) XHEAD, YHEAD, ROECGD, COECGD

I have no idea what it might look like.

Thanks

Pete

tzeis
06-09-2004, 12:27 AM
It would certainly be possible to write the I/O section in C#, and call it from Fortran. If the files you are reading are sequential files written with Fortran, you might need to account for things like record padding and delineators (carriage return and line feed characters) Things will probably work more smoothly if you can write the files as streams rather than records using System.IO. Some methods you might want to investigate are System%IO%File%Open (or OpenRead or OpenWrite) and methods from the System%IO%BinaryReader class. I don't want to get too involved with examples, but to declare and instantiate a filestream and a BinaryReader would look something like this:
use System
use System%IO
character(len=256) :: INFILE = "Somefilename"
type (FileStream), pointer :: stream
type (BinaryReader), pointer :: breadr
type (String), pointer :: Filename
Filename => ustring(INFILE)
Filename => Filename%Trim()
stream => File%OpenRead(Filename)
allocate (breadr, source = BinaryReader(stream))

Once you have the BinaryReader, you can invoke the appropriate method, like ReadString or ReadSingle to read String or floating point data:
indata => breadr%ReadString()
realvar = breadr%ReadSingle()
where indata is of type System%String and realvar is real*4. Depending on what your data files look like, it might be easiest to read the whole file into a String variable and parse the string for the data you want.

cubud
06-09-2004, 10:29 AM
Hi tzeis

I really do appreciate your help. Unfortunately this would require far too many changes in the subroutine, and I really don't want to claim legal responsibilty for the consequences if the routine fails.

Is there any chance of including my "Map file operations through System.IO" request in your future feature list?

Pete

cubud
06-13-2004, 11:00 PM
Hi tzeis

Is there any chance of including my "Map file operations through System.IO" request in your future feature list?



What do you think?

tzeis
06-14-2004, 05:22 PM
At some point, we do want to provide support for the Compact Framework. I will request that Fortran I/O be supported.

cubud
06-17-2004, 10:03 PM
Hi

At some point, we do want to provide support for the Compact Framework. I will request that Fortran I/O be supported.

That's good news. I wont ask when I can have it, but I would like to ask if you could keep hold of my email address and inform me when you make a release which supports compact framework.

Thanks

Pete

cubud
06-27-2004, 02:39 PM
Hi

Something occurred to me yesterday. Because of the interesting nature of the product I am developing in .NET, and the potential to run this product on a mobile device (such as a phone), I honestly believe that I would be able to get quite a bit of press interest. I'm pretty sure that a UK national business news paper would be very interested.

If you would like to discuss this with me, please email pete [at] droopyeyes [dot] com - I'd be very happy to privately discuss the details of the project any why the press may find it so interesting.

Pete