Paste a precompiled application into another C program

Preamble

This could potentially be an xy problem , so I am open to suggestions that deviate from the original question if there is a better way to approach this.


Problem

I have a rather large program that generates a lot of indicators, statistics, etc. One important calculation that I need is the ability to generate the output of a complex mathematical operation. The only tool that can generate this output is a third-party vendor-supplied application. The supplier will gladly compile an application for my company for any OS / distory / architecture, but they cannot give us the source. As a result, our program must rely on a pre-compiled program sent as part of the same project, and the supplier program runs through popen().

Due to installation failures and other problems, a call sometimes fails popen()due to path errors, file transfers, etc. This is not something we can control, but, nevertheless, the client blames him for the developers.


Question

Is there any way using simple c plus on to somehow embed an external application into our own application so that it can be popen()'ed in a private memory mapping, so that the program is always available to our "main" application?

Ideally, we would simply add the source for this program to our own code base and solve the problem, but this is not available to us.

+4
2

1 . Linux/ELF/ ld .

, chmod(2) , , , popen , .


1 , , . , , .

+4

. , , . - , . mkstemp char. chmod popen , .

SO, , , : ?

+1

Source: https://habr.com/ru/post/1673074/


All Articles