Include a include file only once


Go to last post By: keytapper
Today 12:29
Forum: Proton Plus Compiler v3
Starter: towlerg
Views: 0
Replies: 4
Today 12:25
Forum: The Lounge
Starter: towlerg
Views: 0
Replies: 0
Today 12:21
Forum: PICKAT
Starter: davutnacikaya
Views: 0
Replies: 1
Go to last post By: tumbleweed
Today 10:46
Forum: Master Synchronous Serial Port (MSSP) module / 3-wire SPI / I2C / Master and Slave modes
Starter: CharlieBrown
Views: 1780
Replies: 14
Today 09:40
Forum: The Lounge
Starter: Tim
Views: 0
Replies: 2
Yesterday 23:22
Forum: Projects discussion
Starter: creatv
Views: 0
Replies: 5
Go to last post By: charliecoultas
Yesterday 20:43
Forum: The Lounge
Starter: pic-ignorant
Views: 0
Replies: 4
Yesterday 20:26
Forum: Proton Plus Compiler v3
Starter: Frizie
Views: 0
Replies: 7
Yesterday 18:31
Forum: LCD module
Starter: charliecoultas
Views: 0
Replies: 40
+ Reply to Thread
Results 1 to 3 of 3

Thread: Include a include file only once31 days old

  1. #1
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,107
    Thumbs Up
    Received: 191
    Given: 171
    Total Downloaded
    4.82 GB

    0 Not allowed!

    Default Include a include file only once

    I'm writing library files for various sensors. The code for the sensors will be in .INC files and the RAM dimensioning will be in .H files.

    For simplicity and foolproofing I'd like to arrange things so that if the user desires, they can include the .H with any other dimensioning statements (presumably at the top of their code) or as a fall back include the .H file in the .INC file.

    This requires some mechanism to only include the .H file once even though it's include several times. Some dialects of basic allow statements like INCLUDE ONCE "blabla.inc".

    Does anyone have an idea how to do this? I can think of something compilcated with $define and $ifndef but I'd like it to be transparent.
    George.

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,300
    Thumbs Up
    Received: 381
    Given: 137
    Total Downloaded
    1.60 GB

    0 Not allowed!

    Default Re: Include a include file only once

    Take a look at all the compiler's include file libraries in the user includes directory "C:\Users\User Name\PDS\Includes" and you will see headers in them that stop an include file being used more than once in a program, even if it is included more than once:

    $ifndef _Include_File_Name_
    $define _Include_File_Name_

    ' All the include file's code here


    $endif '_Include_File_Name_


    This is standard in most languages and will only add the code within the $ifndef and $endif if it has not been used previously.

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,107
    Thumbs Up
    Received: 191
    Given: 171
    Total Downloaded
    4.82 GB

    0 Not allowed!

    Default Re: Include a include file only once

    Thanks Les.
    George.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. How to pick apart a binary include file
    By SCV in forum Proton 24
    Replies: 22
    Last Post: 28th September 2018, 15:49
  2. Include file search paths
    By johngb in forum Proton 24
    Replies: 2
    Last Post: 28th February 2016, 13:05
  3. Include file name
    By towlerg in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 16th July 2015, 06:48
  4. Missing Include file not detected
    By RGV250 in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 9th May 2014, 12:14
  5. possible problem with include file?
    By TheNewGuy in forum Proton Plus Compiler v3
    Replies: 0
    Last Post: 15th July 2007, 04:21

Members who have read this thread : 33

Actions :  (Set Date)

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts