Thread: Create multiple executables instead of one

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    6

    Create multiple executables instead of one

    Hi,

    Lets say I have 10 cpp files, the compiling and linking will normally create one executable. Instead of that I want to create 10 executables - one for each cpp file. Only one of them has a main and the others will be loaded or linked dynamically. How can I do this in C or C++? If not, are there other languages or engines that allow this?

    Not sure if its clear.

    Thanks

  2. #2
    Registered User
    Join Date
    Sep 2009
    Posts
    5
    I'm not totally clear on why you would want to do this?

    You say 10 executables? If you want 10 exes, you will need 10 main() functions.

    What you could do is build one executable binary, and 9 DLLs. The binary can then load the DLLs at runtime.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    6
    Hi,

    Ok. I meant one executable and 10 dll's. What if there are 200 such files. What problems would I have if I create one executable and 199 dlls? Memory, speed, complexity etc.

    Thanks.

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    You would get performance problems on loading if you didn't rebase them, but other than that, you simply need to define an appropriate interface for them to follow. Hopefully a common interface (preferably C-compatible), such as when these DLLs are all similar plug-in modules.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  2. How to create a file association program?
    By eShain in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2006, 12:15 PM
  3. Multiple Linked Lists w/HeadNode
    By tofugirl in forum C Programming
    Replies: 12
    Last Post: 12-10-2005, 10:21 AM
  4. Cannot create MDI Client Win
    By JaWiB in forum Windows Programming
    Replies: 1
    Last Post: 10-31-2005, 10:05 PM
  5. How to use multiple files?
    By fry in forum C++ Programming
    Replies: 6
    Last Post: 12-22-2002, 09:07 PM