|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
QTran
Joined: 04 Dec 2018 Posts: 2
|
Posted: Tue Dec 04, 2018 5:05 pm Post subject: How to Launch a ftn95 DLL from QT |
|
|
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
QTran |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Tue Dec 04, 2018 7:03 pm Post subject: |
|
|
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 |
|
|
QTran
Joined: 04 Dec 2018 Posts: 2
|
Posted: Mon Mar 25, 2019 1:59 pm Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Mon Mar 25, 2019 4:28 pm Post subject: |
|
|
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 |
|
|
|
|
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
|