replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Windows exectuable with WinMain
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 

Windows exectuable with WinMain

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



Joined: 14 May 2009
Posts: 29

PostPosted: Wed Mar 10, 2010 10:16 pm    Post subject: Windows exectuable with WinMain Reply with quote

Our existing F77 code base uses the following to create a windows executable:

Code:

      integer function WinMain( hInstance,hPrevInstance,lpCmdLine,
     .                          nCmdShow)
     use msfwina


! For Windows Execution
      integer     hInstance
      integer     hPrevInstance
      integer     lpCmdLine
      integer     nCmdShow


!MS$ ATTRIBUTES STDCALL ,ALIAS : '_WinMain@16' :: WinMain


!!!!!!! CODE !!!!!!!!!!!!!!!!!!!!!!!!



      WinMain = 0
      END


I see inside win32api.ins there is a "STDCALL WINMAIN 'WinMain' (VAL,VAL,STRING,VAL):INTEGER*4"

How can I convert the above code to use with FTN95 .Net to create a windows executable?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 11, 2010 11:44 am    Post subject: Reply with quote

There is no WinMain with FTN95.

For standard Fortran input/output you can put WINAPP on a line before the main Fortran program

Code:
WINAPP
program myprog
read*, n
print*, n
end


This will give you a Windows IO window for either Win32 or .NET.

If you want to create a GUI for your program then there are three direct ways to do this...

1) Create a VB .NET form and access a FTN95 assembly (DLL)
2) Create a C# form and access a FTN95 assembly (DLL)
3) Use Silverfrost Visual ClearWin with FTN95

As it happens you can also use the Win32 ClearWin+ from .NET but this is not by design and cannot be guaranteed. In this case (image etc) resources have to be coded into a DLL.
Back to top
View user's profile Send private message AIM Address
silverdan



Joined: 14 May 2009
Posts: 29

PostPosted: Thu Mar 11, 2010 6:13 pm    Post subject: Reply with quote

Paul,
Does winapp have some sort of return code built-in similar to WinMain?

I am not trying to build a GUI exe in FTN95 .Net, but rather a program that gets called from another exe such as VB.

So the scenario is that a VB EXE uses the API GetExitCodeProcess to get the return code from API WinMain in the Fortran EXE.

We are currently using WinMain API in Fortran code to pass along the return code and would like to know how to do this in FTN95 .Net

There is an interface to WinMain inside win32api.ins

STDCALL WINMAIN 'WinMain' (VAL,VAL,STRING,VAL):INTEGER*4

If winapp does not provide a return code, could you give a little pointer on how to use WinMain in FTN95 .Net

Thanks,
Dan
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 11, 2010 7:32 pm    Post subject: Reply with quote

WINAPP is not a function. It sets an attribute on the executable so that it is a Windows executable and not a console executable.

As far as I know, standard Fortran does not provide a way to return an error state to the operating system but FTN95 provides EXIT and EXIT@ for this purpose.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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