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 

VISUAL STUDIO C++ calling FTN95/CLEARWIN

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



Joined: 07 Nov 2006
Posts: 22

PostPosted: Mon Feb 15, 2010 7:57 pm    Post subject: VISUAL STUDIO C++ calling FTN95/CLEARWIN Reply with quote

I want to be able to call CLEARWIN routines from a Visual Studio
C++ program. Since VS C++ appears to only recognise external FTN95
Siverfrost routines I have attempted to set up a simple FTN95 Siverfrost
subroutine in VS FTN95/Clearwin as a project using CtoFORTDRAW.f below
which is then linked to a VS C++ project using CtoFORT.cpp below. I have followed the Siverfrost example in the Samples/Win32 section in Help but have encoutered many inconsistencies and of course I have not managed to get a successful Build.

The simple programs below work OK in Siverfrost FTN95 and Siverfrost C++ if the commented out pragma library line is added.

Any suggestions.

Martin West



//CtoFORT.cpp Demostrates calling FTN95 Subroutine from a C++ Program
//#pragma library "CtoFORTDRAW.OBJ"

extern "C" void DRAWLINE(int *x1, int *y1, int *x2, int *y2);
int main()
{
int x1=0;
int y1=0;
int x2=500;
int y2=500;

DRAWLINE(&x1,&y1,&x2,&y2);

}

//==============================================
C CtoFORTDRAW.F
C See CtoFORT.CPP which calls this routine
SUBROUTINE DRAWLINE(x1,y1,x2,y2)
INCLUDE <WINDOWS.INS>
INTEGER x1,y1,x2,y2
ICNTRL=-1
L=WINIO@('%ww&')
L=WINIO@('%ca[CtoFORTDRAW Draw toutine called from C++]&')
L=WINIO@('%lw&',ICNTRL)
L=winio@('%gr[WHITE]',600,400)

CALL DRAW_LINE_BETWEEN@(x1,y1,x2,y2,0)

END
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Feb 16, 2010 10:09 am    Post subject: Reply with quote

Hi Martin

The usual approach would be to use the Silverfrost SCC compiler for C++. If you use the Microsoft compiler in this context then you will be first or one of the few to attempt this. You can therefore expect problems that none of us have seen before or have the time to resolve for you.
Back to top
View user's profile Send private message AIM Address
MartinWest



Joined: 07 Nov 2006
Posts: 22

PostPosted: Tue Feb 16, 2010 10:50 am    Post subject: VS C++ calling FTN95 Reply with quote

Paul

Is it possible to call Silverfrost SCC through Visual Studio as a VS project in the same way as a FTN95 project can be set up?

Martin
Back to top
View user's profile Send private message
MartinWest



Joined: 07 Nov 2006
Posts: 22

PostPosted: Tue Feb 16, 2010 11:05 am    Post subject: YOUR WIN32 SAMPLE Reply with quote

Paul I have tried your sample following Silverfrost instructions and there are inconsistencies as follows
The author of this sample supplies two instructions for the treatment of the FORTRAN code.

[1] Set the output file to .lib
[2] Select “Extract All”.
The author goes on to state that two files are needed, a dll (for run time) and a .lib.
Now within Visual C++ 2008, under requirement [1], rather than just a single library, there are two option types: available (a) a static library and (b) an import library.
The author’s instructions do not say which of these two library types to choose.
Also within Visual C++ 2008 the requirement [2] “Extract All” does not appear.

Now choosing either of the two options (in the VC++ interface) for the output type of the library file results in failure.
Now choosing the output type as a dll results in an apparent success (rather than an explicit failure).
So presumably the author of the Help section has provided instructions relevant to/for some previous version of VC++.

Can anybody explain what changes to these Help Section instructions are needed to get both outputs in the VC++ 2008 interface?

Martin and Peter
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 -> 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