Re: DirectC: C layer


Subject: Re: DirectC: C layer
From: Kevin Cameron (Kevin.Cameron@nsc.com)
Date: Wed Dec 11 2002 - 09:19:48 PST


Francoise Martinolle wrote:

> At 06:13 PM 12/10/2002 -0500, Andrzej Litwiniuk wrote:
>
>> Michael Rohleder wrote:
>
>> .....The syntax that we agreed upon allows for aliasing. We haven't specified
>> that two different external functions must not use the same C function name.
>> So, at the same time, we may map two formally different functions on the same
>> C function where it makes sense, and allow for user's mistakes.
>>
>> Example:
>> extern "foo_8" void foo_15_8(logic [15:8]); // ok
>> extern "foo_8" void foo_7_0(logic [7:0]); // ok
>>
>> extern "foo" void f1(int,int,int); // undetected conflict!!!
>> extern "foo" void f2(real,string); // undetected conflict!!!
>
> Andrzej,
> we could have the SV compiler checks all the externs and warn/error about these conflicts
>

Unfortunately the SV compiler can't do much with that for C linking, since "foo(...)" is
valid C. If you are linking overloaded C++ it may also be what is intended.

Since engineers tend to use the same name for things, name clashes are quite likely
with C, that's why some people would like to use dynamic loading and C++ - that limits
the scope of the C/C++ names, and differentiates calls on arguments. There would
likely be no conflict for following:

    extern "lib1:foo" void f1(int,int,int);
    extern "lib2:foo" void f2(real,string);

- but a simple C static link isn't going to understand the <library>:<function> spec.

Kev.

--
National Semiconductor, Tel: (408) 721 3251
2900 Semiconductor Drive, Mail Stop D3-500, Santa Clara, CA 95052-8090



This archive was generated by hypermail 2b28 : Wed Dec 11 2002 - 09:20:06 PST