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 DLL and LIB files ???

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



Joined: 08 Mar 2007
Posts: 19

PostPosted: Mon Jun 11, 2007 7:38 am    Post subject: Linking DLL and LIB files ??? Reply with quote

Dear Learned Gurus,

I have mudled my way through generating DLL and LIB files for a subroutine library. Can anyone tell me how I actually use this - i.e., link to a program that needs those subroutines?

The idea is to distribute usable subroutines without allowing access to the source code.

Many thanks,
Ludwig Very Happy
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jun 11, 2007 8:42 am    Post subject: Reply with quote

1. In Plato create a project to build your DLL.

2. In Plato create another project to build an application that uses the DLL.
This project will contain a REFERENCE to the DLL and this is configured via the Project Explorer window.

3. If your library subprograms are all EXTERNAL Fortran 77 functions or subroutines then you do not need anything else in your application code (you do not need any special declarations or USE statements). If your application Fortran code contains Fortran 90 code then you may need to declare your library subprograms using an INTERFACE statement (or a USE statement for MODULE procedures).
Back to top
View user's profile Send private message AIM Address
Neo



Joined: 08 Mar 2007
Posts: 19

PostPosted: Tue Jun 12, 2007 6:17 am    Post subject: Tried that - close, but something is still missing ...? Reply with quote

Dear Paul,

Thanks for your help! I did exactly the following:

1.) Built DLL (filename "mod01.dll") from object file
"mod01.obj", using the SLINK commands:

slink
dll
lo mod01.obj
exportall
file

2.) Opened new project in Plato.

3.) Added "mod01.dll" as a REFERENCE in the
Projet Explorer Window on the right hand side.

4.) Used "Add Existing Items" to incorporate the calling code
that is supposed to use the subroutines in "mod01.dll".

5.) Tried to BUILD. Only REBUILD was usable on the BUILD menu.
Although there was the applicable USE statement in the calling code,
the compiler could not fine that module name (which resides within
"mod01.dll").

I am puzzling over what I missed doing - do you know what is amiss? Question

With many thanks,
Ludwig
Back to top
View user's profile Send private message
Neo



Joined: 08 Mar 2007
Posts: 19

PostPosted: Tue Jun 12, 2007 6:23 am    Post subject: Can I do this inside SLINK command line? Reply with quote

Hello Paul,

One more query - can I do this linking of the DLL using
line commands in SLINK? That might be the easiest for
me...

Best regards,
Ludwig
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Jun 12, 2007 7:13 am    Post subject: Reply with quote

When you compile your application the compiler will need to be able to see the .mod file created with the DLL.

Yes you can do a manual link using SLINK. This is what Plato is doing for you when you do a build or rebuild in Plato.

Note that if you ship an FTN95 DLL tha uses Fortran modules then

a) Your users will have to use FTN95 as well (because .mod files are compiler dependent).

b) You will also need to ship all relevant .mod files for them to USE.

You will have a much wider user base if you make your subprograms EXTERNAL rather than put them in a MODULE.
Back to top
View user's profile Send private message AIM Address
Neo



Joined: 08 Mar 2007
Posts: 19

PostPosted: Tue Jun 12, 2007 8:44 am    Post subject: Thanks - it's all so clear now Reply with quote

Hello Paul,

Finally this makes sense to me.
Thank you so much for your help.

Best wishes,
Ludwig
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Wed Nov 14, 2007 4:16 pm    Post subject: External libraries Reply with quote

Hello Ludwig,

I sort of have the same problem as you did. Since there is no 'nice' example to explain when and how to use .mod, .lib and .dll libraries. An especially why the diffrent options.

From your last post itr seems like you got it wright. I am interessted in how you solved it exactly.

What I would like is to have a single directory with all the modules I use. Compile them once and then link them with whatever program I am developing.

Hope you could give me some tipps Laughing

Jacques
Back to top
View user's profile Send private message
Neo



Joined: 08 Mar 2007
Posts: 19

PostPosted: Sat Jan 19, 2008 10:27 pm    Post subject: DLL library Reply with quote

Hello Jacques,

I happened upon your posting just today - hope this is not way too late.

I went the route of having all of my library routines available as external program units (i.e, not inside modules referenced with USE), which obviated the need to supply all the .mod files in addition to the DLL. Each of these library routines in turn USEs the relevant module(s) in my library.

Therefore, each (external) library routine called by the user is a "front end" for one of the routines in the list of modules.

By the way, you can download the 3d rendering library, which is now finished and very easy to use:

www.quickie3d.com

Best wishes,
Ludwig
Back to top
View user's profile Send private message
Neo



Joined: 08 Mar 2007
Posts: 19

PostPosted: Sat Jan 19, 2008 10:29 pm    Post subject: If you need an example Reply with quote

Hello again,

If you want a short template, I can post one.

Best,
Ludwig
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Mon Jan 28, 2008 3:01 pm    Post subject: quickie3d Reply with quote

Hi Ludwig,

thanks for your reply!

I sort of solved my problem in a unsatisfied way due to the lack of examples.

I will appreciate it if you could you please send me a template.

Quickie 3D looks quite impresive! I am going to take a closer look at it!

Best regards
Jacques
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 -> 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