extern

how to declare a variable as extern in objectivec,so that i can access that in any view controller

i want to access the same variable in all view controllers .... ...

How to correctly write declarations of extern arrays (and double arrays) in C's header files?

Suppose I want to share a global array of data across my program, for example: int lookup_indexes[] = { -1, 1, 1, -1, 2, 1, 1, -2, 2, 2, -1, 1, 1, 2 }; What is the correct extern declaration for this array in the C header file? Also what about an array like this: int double_indexes[][5] = { { -1, 1, 1, -1, 1 }, { 2, -2, 2, 1, -1 } }...

How do I reference a field in another class in a separate aspx page, using C#?

Hello, I have a 2D array of doubles in my Default class on my Default.aspx.cs page, like so: protected Double[,] time; By the time the page loads, I have populated this array from a database. Now, I want to reference this array in another file (Diff.aspx.cs) to avoid visiting the database again. Also, the data is used in a read-only ...

Linkage of various const/static variables

I have a few questions about the linkage from the following variables. By examples of 7.1.1/7 of C++03 and experimenting with compilers (Comeau, Clang and GCC), I came to the following linkage kinds: First static, then extern static int a; // (a) extern int a; // (b) valid, 'a' still internal It's clear to me with accordance to sect...

global variables in C++

In a C++ multi-threaded application with many classes, i am trying to find out what are the methods to define a global variable C style, define it as global in any one source file, define it as extern in a header which is included in the classes that access this variable. Write a Singleton class, which contains these global variables a...

Is there a way to get an extern variable (or function) by name

I thought I read about a C standard library function recently that was able to return a pointer to any extern variable whose name was passed to it as a const char *. I think that it works via linker symbols, if that helps. ...

Debug class, c++, linker error

Hello all, I am trying to write a debug class for a project I am working on, and I do not want to have to pass a debug object around so I was trying to do it this way. However, I do not know why my compiler or linker seems to be skipping the implementation I am writing for it. If I add #include "Debug.cpp" to main.cpp this code works j...

how to declare a external integer variable so that i can access that in in view controller

i want to access variable in all views ,so how can i declare it .... ...

C++ Extern / Multiple Definitions

I am trying to interface to Ada in C++ using externs. What is the difference between these two implementations? Implementation A namespace Ada { extern "C" { int getNumber(); int index; int value; } } Implementation B namespace Ada { extern "C" { int getNumber(); } exte...

undefined reference when using extern

I have the following setup (hopefully this is not too bare an example): A.h typedef std::map<unsigned int, float> MyClass; extern MyClass inst; A.cpp MyClass inst; B.h #include <A.h> void foo(); B.cpp #include <B.h> void foo { inst.myClassFunc(); } Now, when I use inst in B.cpp I get undefined reference to inst. Any id...

C++ accessing variables from .CPP files

I'm a little fuzzy on how variable access between .cpp files works. For instance: main.cpp int main() { int a = i; return 0; } main2.cpp int i; This generates a compiler error on main.cpp, telling me there is no in i in existence. What difference then, does the "static" keyword do in this context? (I tried Googling for it,...

Using c99 in C++'s `extern "C"` blocks

I would like to have a function written in C, but callable from C++ which takes a restricted pointer. This is only available in c99, so g++ doesn't like it, even in extern "C" blocks. How can I get around this limitation? ...

extern "C" (C linkage) by default

Question Do GCC, MSVC, or Clang, or some combination support setting linkage to default to C? Background I have a large mixed C/C++ project, and while it's easy and logical to export symbols in the C++ sources with C linkage, those same sources are assuming the stuff in the rest of the project are under C++ linkage. The current situa...

Why would you use `extern void my_func();` rather than including `my_utils.h`?

I'm working on some code I didn't write and noticed that there are many extern void my_func();. My understanding is that extern in for global variables, not for functions. Is there a practical reason to declare a function as extern rather than putting it in a header file and including that? Or is this just a stylistic choice? ...

(C++) How to declare a stl list as extern?

I have: std::list<Particle> particles; std::list<Particle>::iterator particleit; in my main.cpp. I need to declare both of these as extern in one of my class files, but my compiler gives me some error about a missing '>' when I try the straightforward way. How would I go about fixing this? ...

extern storage class specifier

Section 7.1 of the C++ Standard mentions about 'extern' as a storage class specifier. N3126 - "The extern specifier can be applied only to the names of variables and functions. The extern specifier cannot be used in the declaration of class members or function parameters. For the linkage of a name declared with an extern ...

Defining extern "C" function in C#

I have an ActiveX control written in C# and working when run in an ActiveX compatible program (CoDeSys). The problem I've come across is that in order to allow CoDeSys to interact with the ActiveX control, CoDeSys requires the dll to export the function prototype: void ExecuteActiveXCall(IUnknown* pUnk, char* pszId, char* pszParam, char...

How to name a constant in Objective-C?

What's the naming convention for constants in Objective-C (or most widely used way to name them)? Is there a different criteria for extern constants? Some styles I have seen: NSString* const kPreferenceFirstRun = @"FirstRun"; // Replace "XY" by a prefix representing your company, project or module NSString* const XYPreferenceFirstRu...