Quoting Daniel but replying to both.

>On Sun, 10 Mar 2013 01:12:33 +0100
>Daniel Glöckner <[email protected]> wrote:
>
> [snip]
> 
> > Header files have this:
> > 
> > /*extern*/ nbworks_do_align_t nbworks_do_align;
> 
> It is bad practice to have variable definitions in a header.
> Add the extern to make it a declaration. Then add the definition
> to a single source file in your project.

Right. That was my problem - TCC only exposed it. I've rearranged the
declarations and definitions as explained and it now links.

> > Source files have this:
> > 
> > struct thread_cache *
> >   daemon_internal_initializer(struct thread_cache *tcache) {
> >     extern nbworks_do_align_t nbworks_do_align;
> 
> Why declare the variable inside the function if you have a header
> with a definition/declaration?

Following the example in K&R 2nd ed., Chapter 1.10. However, I didn't
completely understand the chapter (that much is obvious now that I
reread it) and therefore got tangled in the web of my own making.

Thank you people! It now works. If all goes as planed, the
program/library I am working on will be somewhere under
https://gitorious.org/~akuktin/ in a few weeks. Otherwise, one can
google "nbworks".

-- 
You don't need an AI for a robot uprising.
Humans will do just fine.
                     --Skynet

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to