Believe it or not, Fortran

  • Thread starter Peter Morris [Droopy eyes software]
  • Start date
P

Peter Morris [Droopy eyes software]

Hi all

I have a requirement to compile Fortran 77 source for the .net compact
framework.

I have looked at the only two compilers I can find, but both have problems

1) Lahey/Fujitsu: Compact framework not officially supported, any File IO
routines do not work.

2) Salford software: Compact framework not officially supported, not even
the most simple compiled assembly is usable.


All I need to do is to compile existing subroutines (one at a time) into
individual assemblies and then use them from a C# WinForms application. The
routines will simply read data from a file, crunch numbers, write logs to a
file.

Can anyone suggest a compiler which will compile F77 for .net so that I can
try it with the compact framework?

Thanks


--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/
 
D

Daniel Moth

You already know the answer I am afraid.
Just C# and VB.NET and not even plans for anything else.

You could try to write Fortran targeting the Full Framework, then decompile
the assemblies with something like Reflector, then look at the C# version of
the code, then copy that into a CF project...

Cheers
Daniel
 
G

Guest

A classic case where if the compiler could at least tell you you've done
something illegal for the CF it would be nice.

-Chris
 
I

Ilya Tumanov [MS]

While it's not supported by compiler's manufacturer, it might be possible
to do.

The obstacles are:

1. Compiler might use some unsupported IL instructions.
2. Compiler might use some unsupported runtime calls.
3. Compiler might be unable to use alternative libraries to compile against.
4. Compiler might have its own library with implementation of F77 specific
functions (which is, of course, compiled against desktop).

#1 - This is nasty as you will find out about that only at runtime. It can
be solved by tweaking the source code. Apparently, it has been done for
C++:
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compac
tframework/browse_frm/thread/baaaa97add932951#4fc4d7f875f89081
#2 - Won't compile and will tell you what's missing. Tweak the code.
#3 - C# compiler has "/nostdlib" switch which allows you to drop standard
libraries and compile against whatever libraries you want.
I don't see anything like that here
http://www.lahey.com/lf71/lfnet.htm#options It might be possible to trick
the compiler, though.
#4 - I would guess stuff like OPEN/WRITE/REWIND and countless F77 math
functions (e.g. GAMMA) are implemented in a separate assembly you link to.
Sure enough, it's compiled against desktop and won't work on device. If you
have sources, you can tweak them and recompile for CF.
You also can replace F77 statements with BCL equivalents or create your own
implementations of whatever's missing.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Peter Morris [Droopy eyes software]"
 
P

Peter Morris [Droopy eyes software]

Hi

Thanks for the info.

Unfortunately I cannot modify the subroutine itself, I can only alter the
project source which sets up common block variables and executes the
subroutine (legal issues are involved).

Pete
 
I

Ilya Tumanov [MS]

I see…

Can you compile against CF? If not, what are the errors?
Is there assembly with F77 functionality supplied with the compiler?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Peter Morris [Droopy eyes software]"
 
P

Peter Morris [Droopy eyes software]

Hi
Can you compile against CF? If not, what are the errors?

Yes, I can compile and run, I just get a runtime error.

Is there assembly with F77 functionality supplied with the compiler?

There is yes. I think the error is within this assembly, and I'd like to
know which method it is trying to call which is missing in the CF.

Thanks


--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/
 
I

Ilya Tumanov [MS]

Are you sure you're compiling against CF runtime?
I actually doubt you do because you would get compile time errors on
missing methods.

Which command line are you using to compile?

You can not use F77 assembly with CF as it was compiled against desktop.

To get information on missing method during runtime, please install CF SP3:

http://www.microsoft.com/downloads/details.aspx?familyid=a5a02311-194b-4c00-
b445-f92bec03032f&displaylang=en

However, I would predict as soon as you do that, it would stop running at
all with MissingMethodException.
Since you're compiling against desktop, it would try to load desktop
runtime, which is, of course, missing on device.
RTM version of CF has a bug which would ignore that and redirect to CF
runtime, but SP1 and above have this fixed.

Here's what I would suggest:

1. Tweak command line to compile against CF assemblies. This is really
important, you _can't_ compile against desktop runtime. Try it with some
very simple F77 source first.
2. Remove F77 assembly as you can't use it on CF. If you have a sources for
it, you can recompile it against CF. If not, you would have to implement
whatever you're using in it.

Now, compilation attempt would result in compile time errors telling you
what's missing.
Next, you would have to implement missing stuff and add it to your project.
Finally it would compile and you'll be able to run it.
You can be sure no there are no calls to unsupported methods, but you can
hit unsupported IL.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
 
P

Peter Morris [Droopy eyes software]

Hi

The C# app is compiled for CF, but the fortran routine is not. The fortran
compiler has an option to remove all dependencies on its own libraries.
This is why I wanted to know which assembly has a missing method, and what
the name of the missing method is, so that I can inform the developers who
are currently trying to assist me.

Pete
 
I

Ilya Tumanov [MS]

I'm confused. If you remove dependencies on F77 own libraries, compiler
should produce errors on attempt to compile.
It should tell you something like this: "Function X you're trying to use in
line Y in file X is not defined".
So, you know function X is missing.

Or, is F77 compiler so much different from other .Net compilers it actually
ignores what something you're trying to call is missing?

By the way, which F77 compiler are you using?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
<O9SDmbU#[email protected]>
<jLvlDdZ#[email protected]>
 
P

Peter Morris [Droopy eyes software]

I'm using the fortran compiler from Salford Software, search google for
FTN95

The compiler is only a ".net compiler" and not a ".net compact framework
compiler".

Is there some kind of verify tool which I can run on the assembly and it
will tell me why it isn't CF compatible?

Thanks for all of your help!

Pete
 
I

Ilya Tumanov [MS]

There are no "CF" compilers. Same compilers are used to compile C# and VB
for both desktop and CF.
To do so compiler needs to reference CF libraries instead of desktop
libraries.

For example, C# compiler (csc.exe) has /nostdlib[+|-] command line option
to remove references to standard desktop libraries.
Next, /r option should be used to reference CF libraries instead.

Same should be done with FORTRAN compiler. If there's no equivalent option,
this compiler is CF incompatible.

Unless assembly is compiled against CF libraries, it is _NOT_ CF compatible
simply because it was not compiled against CF libraries, no tool is needed.
If assembly was compiled against CF, it might be incompatible because of
unsupported IL instructions, but not because of missing methods.
Missing methods would result in compile time errors, so until this is
corrected, you won't be able to complete compilation.

First step for you would be to figure out how to compile against CF. As
soon as you do that, compiler will tell you what's missing.
Next, missing stuff should be implemented so you can complete the
compilation and get assembly compiled against CF.
Hopefully, FORTRAN compiler does not use unsupported IL instructions. If
so, you're done at this point.

If it uses some unsupported IL, you will find that out only on attempt to
run the application. There's no tool to detect that.

I'll try to come up with a list of unsupported IL, ILDASM can be used to
decompile the assembly and you can search this dumped IL for unsupported
instructions.

I'll see if I can get evaluation copy of this compiler and try it.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
<O9SDmbU#[email protected]>
<jLvlDdZ#[email protected]>
<#TlDQGv#[email protected]>
<dPmjJOz#[email protected]>
 
I

Ilya Tumanov [MS]

I was unable to download FTN95, for some reason web site tells me I'm
unauthorized. I was able to download documentation, though.

It looks like you need to specify which runtime to use in the linker
command line with /R:Assembly1[;Assembly2...] option.
Linker (not a compiler) would produce an error should you try to use some
missing functionality.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
<O9SDmbU#[email protected]>
<jLvlDdZ#[email protected]>
<#TlDQGv#[email protected]>
<dPmjJOz#[email protected]>
 
P

Peter Morris [Droopy eyes software]

Hi Ilya

Thanks very much for your help, you have done so much! I have forwarded
this post + the one about the failed trial download to someone in support at
the company. Hopefully it will help.
I'll try to come up with a list of unsupported IL, ILDASM can be used to
decompile the assembly and you can search this dumped IL for unsupported
instructions.

That would be brilliant, thank you!

Pete
 
D

Daniel Moth

Ilya the list of unsupported IL instructions is probably of general
interest. Looking forward to a list and also info on changes in CF 2.0 in
this area.

Peter, from a ppt slide I know of these two:
<quote>
-Few IL instructions are not supported
calli (call through function pointer)
delegates are supported
localloc (allocation on expression stack)
</quote>

Cheers
Daniel
 
P

Peter Morris [Droopy eyes software]

I was unable to download FTN95, for some reason web site tells me I'm
unauthorized. I was able to download documentation, though.

Hi. I contacted support about this, they said that it is working. Maybe
you could try again?

Pete
 
I

Ilya Tumanov [MS]

No change, here's what I'm getting:

-------------
You are not authorized to view this page
You might not have permission to view this directory or page using the
credentials you supplied.

----------------------------------------------------------------------------
----

If you believe you should be able to view this directory or page, please
try to contact the Web site by using any e-mail address or phone number
that may be listed on the download.salfordsoftware.co.uk home page.

You can click Search to look for information on the Internet.


HTTP Error 403 - Forbidden
Internet Explorer
-------------
Here's the link for this download on a previous page:

http://download.salfordsoftware.co.uk/dl.php?dl=6c9fdc2e28a05be2cee1f6f6e9b0
973b&ac=15a1036fe5976381f405189145c12b25

Best regards,

Ilya


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
<O9SDmbU#[email protected]>
<jLvlDdZ#[email protected]>
<#TlDQGv#[email protected]>
<dPmjJOz#[email protected]>
<#5CneS7#[email protected]>
<djBUR8$#[email protected]>
 
P

Peter Morris [Droopy eyes software]

Hi

http://www.salfordsoftware.co.uk/software/downloads/compilers.html

Personal edition, is that the one you are trying to download?

Pete

"Ilya Tumanov [MS]" said:
No change, here's what I'm getting:

-------------
You are not authorized to view this page
You might not have permission to view this directory or page using the
credentials you supplied.

----------------------------------------------------------------------------
----

If you believe you should be able to view this directory or page, please
try to contact the Web site by using any e-mail address or phone number
that may be listed on the download.salfordsoftware.co.uk home page.

You can click Search to look for information on the Internet.


HTTP Error 403 - Forbidden
Internet Explorer
-------------
Here's the link for this download on a previous page:

http://download.salfordsoftware.co.uk/dl.php?dl=6c9fdc2e28a05be2cee1f6f6e9b0
973b&ac=15a1036fe5976381f405189145c12b25

Best regards,

Ilya


This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
<O9SDmbU#[email protected]>
<jLvlDdZ#[email protected]>
<#TlDQGv#[email protected]>
<dPmjJOz#[email protected]>
<#5CneS7#[email protected]>
<djBUR8$#[email protected]>
Subject: Re: Believe it or not, Fortran
Date: Tue, 18 Jan 2005 16:02:16 -0000
Lines: 9
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 82-36-24-188.cable.ubr02.smal.blueyonder.co.uk 82.36.24.188
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:69038
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework


Hi. I contacted support about this, they said that it is working. Maybe
you could try again?

Pete
 
I

Ilya Tumanov [MS]

Correct, that's the one - personal edition.

Scott Holden promised to come up with a list of unsupported IL and blog it
as soon as he's got some time.
It will be posted at http://blogs.msdn.com/ScottHolden

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
<O9SDmbU#[email protected]>
<jLvlDdZ#[email protected]>
<#TlDQGv#[email protected]>
<dPmjJOz#[email protected]>
<#5CneS7#[email protected]>
<djBUR8$#[email protected]>
<#[email protected]>
<[email protected]>
Subject: Re: Believe it or not, Fortran
Date: Wed, 19 Jan 2005 08:33:01 -0000
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 82-36-24-188.cable.ubr02.smal.blueyonder.co.uk 82.36.24.188
cpmsftngxa10.phx.gbl!TK2MSFTNGXA02.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
..phx.gbl!TK2MSFTNGP11.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:69106
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Hi

http://www.salfordsoftware.co.uk/software/downloads/compilers.html

Personal edition, is that the one you are trying to download?

Pete

"Ilya Tumanov [MS]" said:
No change, here's what I'm getting:

-------------
You are not authorized to view this page
You might not have permission to view this directory or page using the
credentials you supplied.

----------------------------------------------------------------------------
----

If you believe you should be able to view this directory or page, please
try to contact the Web site by using any e-mail address or phone number
that may be listed on the download.salfordsoftware.co.uk home page.

You can click Search to look for information on the Internet.


HTTP Error 403 - Forbidden
Internet Explorer
-------------
Here's the link for this download on a previous page:

http://download.salfordsoftware.co.uk/dl.php?dl=6c9fdc2e28a05be2cee1f6f6e9b0
973b&ac=15a1036fe5976381f405189145c12b25

Best regards,

Ilya


This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
<O9SDmbU#[email protected]>
<jLvlDdZ#[email protected]>
<#TlDQGv#[email protected]>
<dPmjJOz#[email protected]>
<#5CneS7#[email protected]>
<djBUR8$#[email protected]>
Subject: Re: Believe it or not, Fortran
Date: Tue, 18 Jan 2005 16:02:16 -0000
Lines: 9
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 82-36-24-188.cable.ubr02.smal.blueyonder.co.uk 82.36.24.188
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:69038
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I was unable to download FTN95, for some reason web site tells me I'm
unauthorized. I was able to download documentation, though.

Hi. I contacted support about this, they said that it is working. Maybe
you could try again?

Pete
 
I

Ilya Tumanov [MS]

I was able to download compiler from home (looks like there's a problem
with our proxy server).

It is possible to reference CF assemblies, no problem and compiler
complains if you're using missing stuff.

However, I was unable to replace references to desktop mscorlib.dll and
system.dll with CF versions.
I was able to add a reference to CF system.dll, but that would not
eliminate reference to desktop's one.
That is, resulted file contains references to both desktop and CF
system.dll.

Looks like the only way to go is to ILDADM compiled file, replace reference
to desktop mscorlib.dll and system.dll with CF versions and ILASM it back:

Desktop:

..assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) //
..z\V.4..
.ver 1:0:5000:0
}

CF:

..assembly extern retargetable mscorlib
{
.publickeytoken = (96 9D B8 05 3D 33 22 AC ) //
....=3".
.ver 1:0:5000:0
}

Same should be done with System.dll.

Unfortunately, it won't tell you what's missing.
Perhaps, Salford Software can clarify if it's possible to reference
alternative mscorlib.dll and system.dll.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
<O9SDmbU#[email protected]>
<jLvlDdZ#[email protected]>
<#TlDQGv#[email protected]>
<dPmjJOz#[email protected]>
<#5CneS7#[email protected]>
<djBUR8$#[email protected]>
<#[email protected]>
<[email protected]>
Subject: Re: Believe it or not, Fortran
Date: Wed, 19 Jan 2005 08:33:01 -0000
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 82-36-24-188.cable.ubr02.smal.blueyonder.co.uk 82.36.24.188
cpmsftngxa10.phx.gbl!TK2MSFTNGXA02.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
..phx.gbl!TK2MSFTNGP11.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:69106
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Hi

http://www.salfordsoftware.co.uk/software/downloads/compilers.html

Personal edition, is that the one you are trying to download?

Pete

"Ilya Tumanov [MS]" said:
No change, here's what I'm getting:

-------------
You are not authorized to view this page
You might not have permission to view this directory or page using the
credentials you supplied.

----------------------------------------------------------------------------
----

If you believe you should be able to view this directory or page, please
try to contact the Web site by using any e-mail address or phone number
that may be listed on the download.salfordsoftware.co.uk home page.

You can click Search to look for information on the Internet.


HTTP Error 403 - Forbidden
Internet Explorer
-------------
Here's the link for this download on a previous page:

http://download.salfordsoftware.co.uk/dl.php?dl=6c9fdc2e28a05be2cee1f6f6e9b0
973b&ac=15a1036fe5976381f405189145c12b25

Best regards,

Ilya


This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Peter Morris [Droopy eyes software]"
References: <u48DxxC#[email protected]>
<odXIM9O#[email protected]>
<O9SDmbU#[email protected]>
<jLvlDdZ#[email protected]>
<#TlDQGv#[email protected]>
<dPmjJOz#[email protected]>
<#5CneS7#[email protected]>
<djBUR8$#[email protected]>
Subject: Re: Believe it or not, Fortran
Date: Tue, 18 Jan 2005 16:02:16 -0000
Lines: 9
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 82-36-24-188.cable.ubr02.smal.blueyonder.co.uk 82.36.24.188
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:69038
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I was unable to download FTN95, for some reason web site tells me I'm
unauthorized. I was able to download documentation, though.

Hi. I contacted support about this, they said that it is working. Maybe
you could try again?

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top