Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29010 Discussions

Want to convert program to shared library so other program can call multiple instances

marshall-l-buhl
Beginner
315 Views
Hi,

We have a stand-alone simulator (a program) we want to convert to a Linux shared library and call multiple instances of it from another program. In case you care, we have a wind-turbine structural simulator program and we want to use it in a wind-farm fluid-dynamics simulator with an instance of the wind-turbine simulator being used for each wind turbine in the farm. The programs would be coupled in that the wind-farm airflow would affect the turbines and the turbines would affect the airflow.

I am new to shared libraries and don't really know know how they work, what all the rules are, and even what questions I should be asking. Is there a guide I can read that will tell me how I should go about converting a stand-alone program to a shared library?

There is one important issue that does come to mind. Our wind-turbine simulator has data in many modules that are shared by many routines. That is, we don't pass all the data as arguments--the routines USE the modules. Will the various instances of the turbine simulator share the module data in addition to the logic so that one instance would interfere with another instance?

I will be very grateful for any help I get. I tried searching for answers to my questions, but had no luck because I really didn't know how to properly search for this particular issue. General searches for "shared libraries" resulted in a huge number of unhelpful posts.

Marshall
0 Kudos
1 Reply
TimP
Honored Contributor III
315 Views
Several how-to and tutorial web pages on linux shared libraries should come up in any browser search. In case of need for a final authority, there's gnu binutils manual and binutils@sourceware.org mail list.
Normal use of shared object doesn't share data, except for those which are compiled in as static data in the program. For example, a subroutine which you add to the shared library might make the data in a module USEd by it visible. If a program modifies data presented in a shared library, the changes don't propagate to other running copies.
0 Kudos
Reply