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 

Passing Common Block from Main to DLLs

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



Joined: 21 Oct 2016
Posts: 1

PostPosted: Wed Dec 20, 2017 8:53 pm    Post subject: Passing Common Block from Main to DLLs Reply with quote

Hi,

I am new to using DLLs so forgive me if this is a silly question, but I was wondering if there is anyway to pass Common blocks TO a DLL. I am aware of the reverse behavior of DLLEXPORT of a Common FROM a DLL, but I was wondering if there was a method to go the other direction or at least referencing the Common values? Do you have to convert them to arguments or is there a more elegant solution?

By nature, do DLLs exclude this? I saw one response on these forums saying that that was not possible, but on another compiler's page saw that it was. I'm looking to clear up that confusion.

Thanks for the help!
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Dec 22, 2017 5:18 pm    Post subject: Reply with quote

In FTN95 there is no facility to dynamically link data in the way that subprograms can be linked in a DLL. This applies to COMMON BLOCKs and to module data.

Each DLL can have its own global data but data cannot be dynamically linked across DLLs etc.

Perhaps the nearest that you could get to this idea is to use the FTN95 extension to the ALLOCATE statement via a "SHARENAME" attribute. This is available for a Win32 platform and details can be found in (for example) FTN95.chm.

A more usual approach is to keep shared data in a small number of arrays (declared in the main program) and to use an initialisation routine to pass the base address or addresses to the DLL at startup.
Back to top
View user's profile Send private message AIM Address
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sun Dec 24, 2017 12:07 am    Post subject: Reply with quote

what do you mean by
Quote:
use an initialisation routine to pass the base address or addresses to the DLL at startup.
?
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Tue Dec 26, 2017 11:14 am    Post subject: Reply with quote

John,

In FTN95.CHM, use the Search tab with keyword LOC. Then out of the choices, choose 'Other machine level facilities'.

With LOC, you can get the base addresses of any variable or data structure, then pass it as a parameter in a subroutine call, presumably so that your DLL routines then know where to look.

There is a crude example.

I'll assume that the statement "The LOC intrinsic function returns the address of its argument as a 32 bit number." may need to be reinterpreted if you use 64 bit FTN95.

Eddie
Back to top
View user's profile Send private message
narayanamoorthy_k



Joined: 19 Jun 2014
Posts: 142
Location: Chennai, IN

PostPosted: Sat Jan 13, 2018 1:58 pm    Post subject: Reply with quote

Thanks Eddie,

This answer, perhaps supports the clarification for my other thread.
_________________
Thanks and Regards
Moorthy
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