I want to combine two programs into a single executable. One is an open source program that has a rather complex project file, the other is one of mine with a much simpler structure. Because of the relative complexities of the project files I feel it would make most sense to start with the open source project and modify it to include my source files.
My intention is that my program should be in control and treat the other as a collection of utility functions.
I noticed that the open source program has a function called “main()” whereas mine has a “WinMain()”. Presumably I have to tell the compiler to call my WinMain() first. How do I do that?
Is there anything else that I should be aware of in the merging process?
EDIT: Both programs are C++, not C.
EDIT: The open source program does very little io.
EDIT: The key thing I want to know is do I have to modify something in the project settings to say “this is a windows program using WinMain() as opposed to a console(?) program using main()” or will the compiler somehow work this out for itself.
UPDATE: The joint program is now up and running.
If your program has
WinMain(), it is presumably a Windows program, while the other is a command-line app. Depending on what the original apps actually do, this may make it difficult to merge them. E.g. if the other app uses standard input/output extensively, it is challenging to transform it into a Windows app. However, if it is simply a bunch of utility methods without side effects, you may simply add the code to your project and start using it.You have to set up your project to generate a Windows executable, the call to your
WinMain()function will then be arranged automatically by the linker.