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 

Linking to third-party DLLs

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



Joined: 01 Sep 2005
Posts: 1

PostPosted: Thu Sep 01, 2005 12:41 pm    Post subject: Linking to third-party DLLs Reply with quote

I joined the forum a bit too late to see the beginning of the discussion of linking third-party DLLs to FTN 95. Can somebody send me a few lines of code to accomplish this?

Here is a sample of what I want to do -- a sample that is accepted by one Fortran 95 compiler:
INTERFACE
STDCALL FUNCTION Their_Function (my_int1, my_strngptr, my_int2) RESULT (my_i2r)
!DIR$ ATTRIBUTES DLL_IMPORT :: Their_Function
INTEGER*4, VALUE :: my_int1
INTEGER*4, VALUE :: my_strngptr
INTEGER*2, REFERENCE :: my_int2
INTEGER*2 my_i2r
END FUNCTION
END INTERFACE

Here is the same thing, coded for a different compiler:
INTERFACE TO INTEGER*2 FUNCTION Their_Function (my_int1, my_strngptr, my_int2)
!DEC$ ATTRIBUTES DLLIMPORT :: Their_Function
INTEGER*4 my_int1 [value]
INTEGER*4 my_strngptr [value]
INTEGER*2 my_int2 [reference]
END INTERFACE

I am at a loss to figure out what Salford FTN 95 is looking for in an INTERFACE declaration. I have tried various combinations of the above, and everything gives error messages. Would someone please help with this?

If you wish, you could send a private message to me at
harry.akers@mms.gov

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


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

PostPosted: Fri Sep 02, 2005 12:25 am    Post subject: Linking to third-party DLLs Reply with quote

Start by using /IMPORT_LIB <dll_name> on the FTN95 command line.
You can do this from Plato by creating a project and creating a reference in the Project Explorer window.
In this case you will also need to set the properties of reference to STDCALL.

If your call needs an interface (e.g. when using optional and/or key word arguments) then the relevant form in FTN95 is like this

INTERFACE
F_STDCALL FUNCTION foo...
...
END FUNCTION
END INTERFACE

i.e. the keyword for the STDCALL attribribute is F_STDCALL.
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 -> General 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