Re: External C function and duplicate symbol

2008-10-03 Thread Patrick Mau
Hi Christian If you really want a function to appear in multiple object files you could declare them static, like in: static void vec_zero2(int *vect) { vec[0] = vec[1] = 0; } This is sometimes useful if you want to inline small functions and not use preprocessor macros like this: stat

Re: External C function and duplicate symbol

2008-10-03 Thread Brian Stern
It seems that what you want is an inline C function. I don't think this is part of the C language standard but gcc seems to have its own method of doing this. Just do a find on 'inline' in the Frameworks to see how it's done. Look at CGBase.h for instance. On Oct 3, 2008, at 8:32 AM, S

Re: External C function and duplicate symbol

2008-10-03 Thread Scott Andrew
What about using #pragma once at the top of the header file? The other solution is to move the functions to a C file and move just the function definitions to header files. I prefer the second for readability. I usually have a utils.c and a utils.h. I'm not a big fan of function implementat

External C function and duplicate symbol

2008-10-03 Thread Christian Giordano
Hi guys, I've few functions that I'm keeping on an external .h file. If the header is included in more than a class I get duplicate symbol error. I tried using #ifndef which I use on my C++ classes but didn't bring any luck. I had a look to the various headers in the framework and I saw they use th