Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Static library used by two processes?

onkelhotte
New Contributor II
637 Views

Hi there,

I want to create a static library, which is called by two seperate processes. The first process uses some calculation subroutines and functions, the second process should display the results of these calculations.

My questions are:
Can I use the samestatic library simultaneously with two processes? Or do I have to use a dynamic link library?
What about the data?Can the output processaccess the same value of variables as the calculation process? I use a module at the moment where all global variables are stored. Or do I have to change this into COMMON blocks or something else?

Thanks in advance,
Markus

0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
637 Views
Quoting - onkelhotte

Hi there,

I want to create a static library, which is called by two seperate processes. The first process uses some calculation subroutines and functions, the second process should display the results of these calculations.

My questions are:
Can I use the samestatic library simultaneously with two processes? Or do I have to use a dynamic link library?
What about the data?Can the output processaccess the same value of variables as the calculation process? I use a module at the moment where all global variables are stored. Or do I have to change this into COMMON blocks or something else?

Thanks in advance,
Markus

You can use the same static library with two processes of course. Oh, you also want data sharing :-P? That's completely orthogonal to static vs. dynamic library issues: basically, two processes in Windows are separate worlds, which by default cannot share any memory (apart from some system resources such as kernel handles). That's by design -- you don't want your process to mess or to be messed with by another process, don't you?

Your options for IPC are listed here. Of those, pipes you already know about, and some Fortran wrappers for memory-mapped files can be found here.

Apart from those, you can use shared data segments (see here); that requires a Dll to work. I think that people have done that for Fortran so someone could provide an example. The gotcha is that "Any variables in a shared data segment must be statically initialized.", i.e. no allocatables.

0 Kudos
Steven_L_Intel1
Employee
637 Views

IVF 10.1 and later supplies a DLL_Shared_Data sample which illustrates using a DLL to share data between processes.

0 Kudos
onkelhotte
New Contributor II
637 Views

IVF 10.1 and later supplies a DLL_Shared_Data sample which illustrates using a DLL to share data between processes.

Thanks both of you, I will check the sample later this Friday.

Markus

0 Kudos
Reply