View Single Post
Old Jul 13th, 2005, 8:59 AM   #1
lgiordano
Newbie
 
Join Date: Feb 2005
Posts: 8
Rep Power: 0 lgiordano is on a distinguished road
Read Programm Version from outside

Hi, this is my problem:
I have two programms (both made by me): my main application and an external one. The external one must read the main app version. The version is declared as: #define APP_VERSION (XX). I dont know very much about compilers/linkers, but I think that the defines are not mapped into the exe. However, I use APP_VERSION to print in some places of my app, so somewhere in exe it should appear. But, as the main app changes some code in new versions, I can't read in a some fixed exe position, and be sure to always read version ok.
My question is, how can I make some code, or tell the compiler/linker to map a constant in the exe in an fixed position? Until now, I am doing this:
main() 
{
  /* I only use this printf() to print version, not because I want to show it */
  /* here, but to make it appear in the exe in a fixed pos, as it is the first */  
  /* instruction executed, so it is easy to find it in exe */
  printf("%d", APP_VERSION); 
...
...

}
Best wishes from Argentina!
lgiordano is offline   Reply With Quote