Fortran Fortran - c interprocess communication

AI Thread Summary
Interprocess communication (IPC) between a Fortran 90 program and a C program is feasible, allowing real-time updates of .xyz files modified by either program. Various IPC methods can be employed, such as named pipes, which facilitate data exchange between processes. Another option is using a network protocol, which, while potentially complex, can effectively manage communication through a publish/subscribe model. For practical implementation, the C program can utilize the sockets library for TCP/IP communication, while Windows users can refer to the Winsock API. Named pipes are also a viable solution, and resources like the Windows API documentation and CodeProject articles can provide further guidance. The source code for both programs is available for modification, enabling the integration of these IPC methods. A loop could be implemented to continuously check for changes in the .xyz files, ensuring that updates are reflected in both programs.
Radight
Messages
3
Reaction score
0
there is a program in written in fortran 90 and a program written in c, the first program is able to modify .xyz (mol files) and the C program can read those,
so is it possible to make an interprocess communication between these 2 program to let one update instantly if i change anything in the fortran progra for example or in the c program
if i change anything in the .xyz file using fortran it should instantly appear changed in the c program and vica versa
is that possible somehow? i am not sure about c and fortran interprocessing abilities
thanks for the help in advance

i think my problem is quite similar to this topic but i am not using 2 fortran program so that's why i am not sure about compatibility that c and fortran is compatible in both ways or not
https://www.physicsforums.com/archive/index.php/t-104004.html
 
Technology news on Phys.org
Radight said:
there is a program in written in fortran 90 and a program written in c, the first program is able to modify .xyz (mol files) and the C program can read those,
so is it possible to make an interprocess communication between these 2 program to let one update instantly if i change anything in the fortran progra for example or in the c program
if i change anything in the .xyz file using fortran it should instantly appear changed in the c program and vica versa
is that possible somehow? i am not sure about c and fortran interprocessing abilities
thanks for the help in advance

i think my problem is quite similar to this topic but i am not using 2 fortran program so that's why i am not sure about compatibility that c and fortran is compatible in both ways or not
https://www.physicsforums.com/archive/index.php/t-104004.html

There are different ways you can do this.

In terms of Inter Process Communication (IPC), typically you use pretty standardized objects like pipes. A pipe is basically a read,write,(or both) object and typically what happens is that programs create specially named pipes, and then each process will get the appropriate handle and then send and receive data to it, as if it was like a network connection.

Similarly one trick you could use is to use a network protocol of some sort. This could be overkill, but it does work.

In the context of your problem (making changes to file, need to update other programs), there is bound to be an OS level framework that allows this, but I haven't tried it myself. In terms of IPC, I've used the network idea and used a standard protocol framework that uses publish/subscribe (fancy way for managing events and callbacks) and with that you just make a connection and send a network packet to another port on the local machine.

I haven't used FORTRAN though, so what kind of access can you get to functions in DLL's? Is there a platform library, or some way of getting access to system level libraries (DLL's or SO's)?
 
i am not sure about what you are asking but i don't think so you can access systems dll`s

by the way would you be more specific or can you provide any links about your ideas where i can look for details how to do it and which program i have to rewrite to make this communication possible?

i got the source code of both program so i can change anything i want in c and the fortran one as well but i am not sure how to do it

i was thinking about a loop first (thats runs with the program till quitting) which is checking for changes in the files or something
 
Radight said:
i am not sure about what you are asking but i don't think so you can access systems dll`s

by the way would you be more specific or can you provide any links about your ideas where i can look for details how to do it and which program i have to rewrite to make this communication possible?

i got the source code of both program so i can change anything i want in c and the fortran one as well but i am not sure how to do it

i was thinking about a loop first (thats runs with the program till quitting) which is checking for changes in the files or something

In terms of the networking ideas, its basically implementing a simple network model based on the reliable TCP/IP protocol. For this, just look at the sockets library. Windows has an implementation called Winsock, which you you will want to check out for windows, or on the *nix platform, just use the standard sockets library.

For pipes, just look up named pipes. If you want more details look at the Windows API documentation.

You should also look at things like this:

http://www.codeproject.com/KB/threads/Win32IPC.aspx
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Back
Top