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 

Procedure to create a DLL project in FTN95

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





PostPosted: Thu Nov 03, 2005 4:30 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

Hi,
I need to know how to program a DLL in FTN95. The Digital Fortran mechanism does not seem to work here. I could not find anything about this matter in the documentation, so please help find the necessary information.

Best regards
Ezzat
ezzat@abu-azzah.net

ezzatoa
Back to top
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Thu Nov 03, 2005 3:59 pm    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

All of the answers you require are in the help file but the answer to this question depends on how you plan to use FTN95 and how you plan to use the produced DLL. If using it via Visual Studio then it is possible to set the output file type to be a DLL, similarly if using Plato3 there are a DLL project type. If simply using FTN95 from the command line then the documentation for the linker, SLINK should provide all the information you need.

For Visual Studio check the docs under:

Getting Started with FTN95 using Visual Studio -> A simple Fortran project - and when you create a project use the 'FTN95 Application Extension' project type

For Plato3 the documentation can be found at:

Getting Started with FTN95 using Plato3 -> A simple Fortran project - and again select the appropriate project type, in the case of Plato a 'Fortran DLL' project

For SLINK check out:

Win32 Platform -> Using the linker -> Libraries -> Generation of DLLs and exporting of functions - it would be useful to read this section in any case as Visual Studio and Plato3 make use of SLINK behind the scenes, so its good to know what is going on should you run into any difficulties.

Should you ever wish to inspect a binary file for the exact specification of exported functions etc. then the Microsoft tool dumpbin.exe (with the command line switch of /EXPORTS) is really handy, this tool ships with Visual Studio, but you may be able to get hold of it or a similar tool elsewhere.

You can also produce .NET assembly DLLs should you have the need and again, there are various ways to achieve this, all documented in similar sections.
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Tue Nov 15, 2005 7:14 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote


>> Win32 Platform -> Using the linker -> Libraries -> Generation of DLLs and exporting of functions - it would be useful
>> to read this section in any case as Visual Studio and Plato3 make use
>> of SLINK behind the scenes, so its good to know what is going on should you run into any difficulties.

True - but how do you enter, via Plato3, the SLINK commands to create import libraries (and so on) so that an executable can load a DLL at run time? This is =not= clear from the online documentation.




Donald Whitlock
Back to top
Anonymous
Guest





PostPosted: Wed Nov 16, 2005 4:51 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

[small]Donald Whitlock wrote:[/small]
True - but how do you enter, via Plato3, the SLINK commands to create import libraries (and so on) so that an executable can load a DLL at run time? This is =not= clear from the online documentation.

Specifically. I have the following two projects:


1. A dll with the following source

subroutine donald
character(len=*), parameter :: name = 'Donald'
write (6,'(a)') name
end subroutine donald

which when built produced the following messages:

Compiling file: dll-module.f95
Compilation completed with no errors
Linking...
Creating archive: dll-module.lib
WARNING - Default LibMain being provided
Creating dynamic link library: CheckMateWin32dll-module.dll


2. An executable with the following source

program invokeDll
call donald
end program invokeDll


which when built produced the following messages:

Compiling file: main.f95
Compilation completed with no errors
Linking...
WARNING the following symbols are missing:
DONALD D:filesprojectsmain-for-dllCheckMateWin32main.obj
(D:FILESPROJECTSMAIN-FOR-DLLMAIN.F95)
Creating executable: CheckMateWin32main.exe


What am I omitting to do to get the executable to invoke subroutine donald; and especially, how do I do it - =in= =detail= ? I've just spent
two hours trying to piece together information from the Salford F95 online help, with no success. I think the help should be greatly expanded.



Donald
Back to top
PaulLaidler
Site Admin


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

PostPosted: Wed Nov 16, 2005 5:59 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

Donald

The way to do this is to create a Reference in the Project Explorer window.
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Thu Nov 17, 2005 1:27 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

I've now tried that: created a reference in the project of the main program to dll-module.lib. I tried it with and without the "Use STDCALL" option.

Still I get:

WARNING the following symbols are missing:
DONALD D:filesprojectsmain-for-dllCheckMateWin32main.obj
(D:FILESPROJECTSMAIN-FOR-DLLMAIN.F95)
Creating executable: CheckMateWin32main.exe

I also checked that the dll project was built with the exportall option.

This seems a very unforgiving piece of functionality to somebody who's never used it before. I suggest that if I ever get this working, all the help you guys at Silverfrost support are giving me should be incorporated in the online help. Perhaps another tutorial?

Donald.
Back to top
Anonymous
Guest





PostPosted: Thu Nov 17, 2005 1:44 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

Paul:

I had another thought.

Perhaps the quickest way would be for you to build and run my little bit of code under Plato3, then WinZip up the project file and source files and email them to me. Then I could open the project, have a poke about and see where I went wrong.

I stick to what I said about the online help, though.

Donald.



Back to top
PaulLaidler
Site Admin


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

PostPosted: Thu Nov 17, 2005 2:23 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

Donald

I was thinking that you would create a DLL and reference the DLL.
Maybe a LIB will work in this way but I would have to check this out.
If you are really stuck then it is not that difficult to use SLINK from a Command Prompt.

I am unable to give you my email address here but if you can find a way to send your zip files then please go ahead.
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Thu Nov 17, 2005 8:59 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

Paul:

I've followed your suggestion and tried rebuilding with a reference to the .dll rather than the .lib.

The good news: there is no longer an unreserved external reference to subroutine 'donald'.

The bad news: When I execute it in debug mode it goes into an unending loop
before even getting to the first executable statement! Ho-hum ....

I've zipped up the two projects. Since your colleague Andrew Smith has
published his email address (as you haven't) should I email them as an
attachment to him for him to forward to you?

Donald.
Back to top
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Sat Nov 19, 2005 7:12 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

The way to get around this problem when using Plato is to make sure you copy the DLL you have referenced to the output folder for your executable.

Plato should probably be doing this for you and we will look into why this is not the case. When using Visual Studio the DLL will be copied, or alternatively you can use the command line compilers/linkers and debuggers to get the desired result.
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Wed Nov 30, 2005 1:46 am    Post subject: Procedure to create a DLL project in FTN95 Reply with quote

Andrew: I'm emailing you a zip file of my main and dll projects. Please could you build them and tell me what I'm doing wrong?

Thanks.
Donald.
Back to top
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