how to declare C's static function?

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 28 03:45:31 PDT 2016


On 2016-03-28 06:02, aki wrote:
> Hello,
>
> When I porting legacy app. written in C to D,
> I have a problem.
>
> file a.d:
> extern (C) private void foo() {}
>
> file b.d:
> extern (C) private void foo() {}
>
>   Error 1: Previous Definition Different : _foo
>
> In C language, "static void foo(){}" does not
> export the symbol out side the compilation unit.
> In D, the function foo() above conflicts even if
> it is private. How can I declare C's static function?

Can you declare the function as "package" in one module and import it 
into the other module?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list