NO

Author Topic: Debug through Include file(2)....  (Read 2390 times)

CommonTater

  • Guest
Debug through Include file(2)....
« on: February 05, 2012, 07:33:43 PM »
For blairon...
 
Quote
how do you share a reusable code portion with a lot of different programs?

The original thread on this was locked... but I thought this deserved an answer. I hope this is ok with our esteemed moderators...
 
Attached is your example include project... fixed and working with proper debugging.  This will show you the basic form of sharing code *within* a project... by using header files that can be included in multiple source files...
 
For the larger, more nebulous problem of shaing code between projects you have two choices... Write libraries or write DLLs.... I personally prefer to write libraries as they are linked directly into your program rather than relying upon an external file, which may become lost or corrupted.  Others will give you the opposite argument that DLLs are better because you can update the DLL without re-writing or re-installing the whole program... so it becomes situational, where you use your best judgement at the time.
 
If you want to see how libraries are built take a look at... http://forum.pellesc.de/index.php?topic=3685.0  and download the zip file.
 
 
 
 
« Last Edit: February 05, 2012, 07:38:31 PM by CommonTater »

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Debug through Include file(2)....
« Reply #1 on: February 06, 2012, 08:53:31 AM »
Quote
how do you share a reusable code portion with a lot of different programs?
Via .C=>.obj/.lib files...

Those then get linked together with each of those different programs, with their function/variable/type definitions in corresponding .h header files. Just like you do it with the standard libraries of C functions that get included with each C program...

Or in case or Windows, you can create .DLL files once and call their functions from different programs.

Ralf

PS: Would be nice to know why the original thread got locked...  :o

blairon

  • Guest
Re: Debug through Include file(2)....
« Reply #2 on: February 06, 2012, 08:57:29 AM »
OK
thank you very much Guys.