0

I work in company that writes generators of C++ source files based on different input files in our language.

These files are then compiled using standard C++ compiler (MSVC cl, gcc) into the executable and after the compilation, they are removed.

These generated files are depended on number of include files and linked with static libraries containing static code (not dependent on the source files). These files are present in installation directory of our product.

Is there any solution / program / technology that can be used to hide these generated files from user filesystem but keeping them visible for the C++ compiler?

I am looking for cross platform solution (Linux, Windows), something like user space filesystem.

Thanks for any suggestions.

Petr Hons
  • 3
  • 1
  • 2
  • 1
    Why would one want to do that? This would only add enormous intransparency to the whole process and setup. Who should benefit from that? – arkascha Feb 01 '16 at 11:15
  • static libraries don't contain source code, they contain object code, surely? – Richard Hodges Feb 01 '16 at 11:20
  • Looks like an XY problem: http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem – Richard Critten Feb 01 '16 at 11:22
  • @arkascha Its intended to protect the knowledge inside the generated files, so the customer will receive what he paid for but the competition cannot easily get the knowledge. – Petr Hons Feb 01 '16 at 11:29
  • @RichardCritten It is partially XY, because i was trying to describe the usage the best I could. But have not found any solution so any other way of protecting of those source files will be great – Petr Hons Feb 01 '16 at 11:31
  • Ah, so this is about the protection of "intellectual property". OK. This used to be a wide spread business strategy in the 90th, things have changed since. Most people agree these days that source code is nothing that should be kept secret, since that drastically reduces the overall quality of solutions. Your property should be the knowledge how to create that source, not the source itself... – arkascha Feb 01 '16 at 11:34
  • And the knowledge how to use that source and generated programs - have been working in a company, where a new guy would not only be unable to compile the application without extensive knowledge how to do that, but even to launch the application afterwards as it required a lot of manual nontrivial configuration steps ... even the customers were not able to upgrade by themselves, they always had to use the company services (and indeed pay for it) ... that was a very interesting business model :D – EmDroid Feb 01 '16 at 11:40
  • Are you trying to protect against script kiddies? If the compiler can see it, anybody can see it (with a bit of effort). – Karoly Horvath Feb 01 '16 at 11:47
  • @KarolyHorvath Yes kind of, because currently the compilation is controlled from our CLI that run scripts (Python), that allows great flexibility but also you can intercept the files. – Petr Hons Feb 01 '16 at 11:53
  • @axalis The protection is probably the old thing, i personally also hate the DRM etc. But the compilation is completely controlled by CLI (single command) and resulting executable has very few flags, thats all. But we might get to your state as well, when the complexity will be just too high. Just trying to get all possible solution (do not hide the sources is also one of them) and choose the best one. – Petr Hons Feb 01 '16 at 11:53

1 Answers1

0

With gcc you can compile directly from stdin: How to compile code from stdin?, just need to provide the input language option (which is normally detected from the file name).

Not sure about MSVC though.

Community
  • 1
  • 1
EmDroid
  • 5,918
  • 18
  • 18
  • Yes, this might work, but we will have to implement C preprocessor of source files to protect our header files. But this solution will solve the protection of the source files only. – Petr Hons Feb 01 '16 at 11:32