This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Inter-package visibility


>>>>> "Michele" == Michele Portolan <michele.Portolan@imag.fr> writes:

    Michele> Hi,
    Michele> I defined  package of mine, but I cannnot use it inside other eCos
    Michele> pre'existent ones.
    Michele> I have:
    Michele>  a configuration header: <pkgconf/mypkg.h>
    Michele> a module header and relative source file:  mymodule.h and mymodule.c
    Michele> inside I have only one function: void myfunction(void)
    Michele> in mymodule.h i defined it as "extern" (I saw it done in some examples, like
    Michele> errno.h/errno.c)

    <snip>

    Michele> What is the problem? Please help, I am completely
    Michele> blocked!

At a guess the problem is caused by C vs. C++ linkage. The kernel is
written in C++ so by default it will expect myfunction() to be a C++
function, not a C one. In mymodule.h use externC instead of extern.
externC is a macro defined in cyg/infra/cyg_type.h which will do the
right thing irrespective of whether you are compiling C or C++ code.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]