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 

How to Launch a ftn95 DLL from QT

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



Joined: 04 Dec 2018
Posts: 2

PostPosted: Tue Dec 04, 2018 5:05 pm    Post subject: How to Launch a ftn95 DLL from QT Reply with quote

Hello together,

I currently look for possibilities to change from our old Compaq Visual Fortran compiler to FTN95.
Our current Compaq project is the calculating core for a different software and therefor results in a DLL, which is then called from QT.
Exactly here is now my problem:
With our old Compaq visual Fortran compiler we could call the functions and declare the attributes as shown below.
Code:

SUBROUTINE cctdll(n,m,error,iarray,oarray,ebarray,ebtarray,fanarray,Textarray)

! Expose subroutine cctdll to users of this DLL
!

!DEC$ ATTRIBUTES C, REFERENCE, DLLEXPORT, ALIAS : 'CALC' :: CCTDLL



Now with the new compiler (FTN95) QT cannot find the functions/Subs anymore and gives the unresolved external symbol error.

Quote:

Cannot resolve symbol "CALC" in cctcalc.dll:cctcalc.dll


Is there anyone that has experiences with this mix of languages and can help me find the problem? Is it me or the compiler? Just for information here is the call from QT that worked so far.

Code:

      // Now call Fortran
      
      QLibrary myLib("cctcalc.dll");
      
      typedef int (*MyPrototype)(int, int, int*, double*, double*, double*, double*, double*, char* );
      
      MyPrototype myFunction = (MyPrototype) myLib.resolve("CALC");



Thank you for your help, I am quite new to Fortran and might ask some silly questions, donīt blame me for this Razz

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


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

PostPosted: Tue Dec 04, 2018 7:03 pm    Post subject: Reply with quote

Basic information can be found in ftn95.chm under Win32 platform->Mixed language programming->Calling C/C++ from FTN95.

You will need to find out whether to use C_EXTERANL or STDCALL. After that the interfaces for the two protocols are the same.
Back to top
View user's profile Send private message
QTran



Joined: 04 Dec 2018
Posts: 2

PostPosted: Mon Mar 25, 2019 1:59 pm    Post subject: Reply with quote

Hello,

after some time I figured out how to export the respective routines to my Library. But how can I tell the compiler now to Declare it as a C - Style function what was done before with this line?

Quote:

! Expose subroutine cctdll to users of this DLL
!

!DEC$ ATTRIBUTES C, REFERENCE, DLLEXPORT, ALIAS : 'CALC' :: CCTDLL


If anyone could help me, this would be very nice.

Than you in advance
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Mar 25, 2019 4:28 pm    Post subject: Reply with quote

If you are creating a 32 bit DLL then you will use SLINK to do the linking process.

SLINK has an "exportall" command that simply exports all routines. Otherwise you can list the routines to export.

If you have to create an alias then this must be done via SLINK commands and details can be found in ftn95.chm. Otherwise you could use the original names for the routines and change the QT code accordingly.
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