c++ - Link an .obj or .lib to a pre-existing executable -


i have pre-existing executable, have no source, want link object file or static library (c++), do have source. i'm using visual studio 8.0.

the number 1 thing question, please don't ask why need this. want know how (i'm pretty sure can done).

i tried adding "myprogram.exe" executable "additional dependencies" c++ linker project property. results in following linker command line options:

/out:"c:\users\me\documents\visual studio 2008\projects\samplecpplibrary\debug\samplecpplibrary.lib" /nologo myprogram.exe

when build project, error:

error 1 fatal error lnk1107: invalid or corrupt file: cannot read @ 0x268 c:\users\me\documents\visual studio 2008\projects\samplecpplibrary\samplecpplibrary\myprogram.exe 1 samplecpplibrary

i figured trying create .lib has executable linked in might inherently wrong. changed project type exe, , intentionally did not give main entry point. instead gave this:

extern int _tmain(int argc, _tchar* argv[]); 

my hope entry point in pre-existing executable fill gap linker. unfortunately, error remained unchanged. there wrong concept (and know weird)? or perhaps need set additional flags indicate nature of exe being linked with?

you can't link executable object - because can have 1 main.

what want call existing executable function system() or popen() call in new app.

edit: if need deliver single 'exe' have included helper program before binary resource (ie icon) had caller write %temp%, executed , deleted it! there apis create temp file can't seen other users.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -