Answer the question
In order to leave comments, you need to log in
How can I pass a link/address to a relatively large file from go to c++?
In general, such a problem is that a program on go downloads a file in memory with an average size of 10-15 mb, and it needs to be processed while it is in memory and it does not need to be placed on disk, but the file should be processed by a program in c ++, the question is whether to somehow transfer the address of a file in memory from one program to another. I think that it is possible to dig towards shared memory, but I have no experience with this and perhaps there is an easier way to do this.
Answer the question
In order to leave comments, you need to log in
Of course have. Write everything in one language. Or use a temporary file. Or organize IPC in any way and transfer the file.
Do not do this - do not rummage the memory of processes. Can tear off a leg.
Exchange data, for example, via a local socket.
If you still have a keen desire to make a trolleybus from a loaf of bread, here is an example of something similar https://stackoverflow.com/q/28778521
Easier than SharedMemory is just saving to disk and then reading the file by another process.
And if the downloaded file is in gigabytes. Where do you put such a file in memory? In my opinion this is not the right strategy.
You can use shared memory to provide access to a file. But you still need to let the external program know that the memory is ready to be processed. And also after processing, the external program must let your program know that it has finished its work. IPC mechanisms are indispensable here: pipes, named pipes, unix sockets, eventfd, regular sockets, ...
But if an external program is launched from your program as a child process, then you can simply wait for the process to complete. But the process can terminate abnormally, so you need to analyze the return code that the process must necessarily return.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question