Re: gcc question

From: Giorgos Keramidas (keramida_at_ceid.upatras.gr)
Date: 02/25/05

  • Next message: àÒÉÊ: "Install Free BSD without floppy, without bootable CD-ROM-drive, without boot from LAN etc."
    Date: Fri, 25 Feb 2005 08:28:30 +0200
    To: Kathy Quinlan <kat-free@kaqelectronics.dyndns.org>
    
    

    On 2005-02-25 11:34, Kathy Quinlan <kat-free@kaqelectronics.dyndns.org> wrote:
    >Daniel O'Connor wrote:
    >>On Thu, 24 Feb 2005 17:57, Kathy Quinlan wrote:
    >>> ATM it is written in codevisionAVR which is where the function is
    >>> called, so I guess for now I will just break the AVR support;)
    >>
    >> Ahh..
    >> So.. are you talking about getting the coding running _in FreeBSD_ or
    >> compiled on FreeBSD and running on an AVR?
    >
    > I am talking about getting the same code running under FreeBSD AND the
    > AVR with minimal changes.

    The easiest way is to hide the differences of the two platforms under a
    properly designed abstraction layer. IIRC, it was putchar() that was
    giving you trouble. Don't call it as putchar(), then. Write a wrapper
    function, which gets properly defined either for either system. The
    header that defines the wrapped functions' API can be common, i.e.:

            #ifndef __WRAPPER_H
            #define __WRAPPER_H

            #ifdef __cplusplus
            extern "C" {
            #endif

            int sendbyte(int val);

            #ifdef __cplusplus
            }
            #endif

            #endif /* __WRAPPER_H */

    The implementation of the sendbyte() function may be in either a common
    file sprinkled with #ifdef's for othe various platforms, or in separate
    files that are conditionally added to the build depending on the current
    platform.

    I hope this helps,

    Giorgos

    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: àÒÉÊ: "Install Free BSD without floppy, without bootable CD-ROM-drive, without boot from LAN etc."