Linking with another executable
Hello
I am writing two executables, one being a unit test application of the other. The unit test has access to the headers of the first executable and I am looking for a way to use the functionalities.
Is there a way to statically link to another executable... Some linker option make it look like a library, perhaps.
I know that I can make a library from the first exectutable's code, but I'd prefer to save this step
Thanks for any help
Re: Linking with another executable
Are both executables .EXE programs ?
You can exports functions from .EXE just like the way DLL do, and your second application can use it (the exe which exported functions will be totaly used like DLL, it wont run separately.)
Re: Linking with another executable
Quote:
Originally Posted by SeventhStar
Is there a way to statically link to another executable... Some linker option make it look like a library, perhaps.
NOPE.
Re: Linking with another executable
Statically linking to executable can be totaly equvivalent of including the source(of the exe which you want to treat like static library) in project.
Re: Linking with another executable
Yes, but I didn't want to lose time in linking the same files again...
Guess I'll have to do it...
Thanks anyway
Re: Linking with another executable
You could use incremental linking. Linking's a fairly quick process though.
Re: Linking with another executable
Quote:
Originally Posted by GCDEF
Linking's a fairly quick process though.
Well it takes about 20 seconds for the linker to make an executable and about 14 seconds for the librarian to build the library.
I just wanted to skip these 14 seconds somehow...
Re: Linking with another executable
Quote:
Originally Posted by SeventhStar
Well it takes about 20 seconds for the linker to make an executable and about 14 seconds for the librarian to build the library.
Buy a new computer, or at least upgrade its physical memory.
Re: Linking with another executable
Well it's amd athlon 64 x2 dual core 3800+ (2 ghz), 2 gb ram, hdd hitachi sata2 7200rpm 8mb cache
Should I really?
Re: Linking with another executable
This is more than enough, I think the source code must be huge.....or you might not have Defragmented your hard disk in last 2 years. :D
Re: Linking with another executable
Quote:
Originally Posted by SeventhStar
Well it's amd athlon 64 x2 dual core 3800+ (2 ghz), 2 gb ram, hdd hitachi sata2 7200rpm 8mb cache
Should I really?
Normally, not.
Well, my computer is just a poor Pentium 4 - 2.8 GHz, 1GB RAM and never faced such type of problems.
Who knows? Maybe exchanging them, I can help you to get rid of troubles. :p ;)
Re: Linking with another executable
Yep... and with libraries like Boost, LuaBind and even the standard library, the compiler expands the template code to 6-7 times it's original size
Re: Linking with another executable
Quote:
Originally Posted by Krishnaa
or you might not have Defragmented your hard disk in last 2 years. :D
AFAIK (but not quite sure) disk defragmenting for NTFS is just a funny waste of time.
Anyhow, I don't remember last time I did it. Usually I reinstalled OS more often than once at two years. And in that case the best disk defragmenter is "format". :D
Quote:
Originally Posted by Krishnaa
This is more than enough, I think the source code must be huge.....
I remember some clever guys using a cool design tool. After few months of design work, they pushed "Generate Code" then "Build". The resulted 1GB executable made them real troubles, indeed. :D
Re: Linking with another executable
Quote:
Originally Posted by SeventhStar
Yep...
That's a reason for which those blamed guys from Microsoft invented DLLs for us. ;)
Re: Linking with another executable
Quote:
Originally Posted by SeventhStar
Well it takes about 20 seconds for the linker to make an executable and about 14 seconds for the librarian to build the library.
I just wanted to skip these 14 seconds somehow...
Forgive me, no offence, but...
If you want skip them then skip them. :) The possible ways for skipping (in order of preference):- Think 14 seconds about your girl/wife, look at her photo.
- Take a couple sips of espresso/coke.
- Look at the window/aquarium/magazine cover
- Think about your code deciding how to improve its design and eliminate its frequent re-building
Now, been gravely serious... Man, are you kidding? Do you really cannot stand 14 seconds of build? Or even 34? Then choose the last variant.