Click here to Skip to main content
15,891,633 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow13-Jun-05 6:08
David Crow13-Jun-05 6:08 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie13-Jun-05 6:16
CNewbie13-Jun-05 6:16 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow13-Jun-05 6:27
David Crow13-Jun-05 6:27 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie15-Jun-05 19:32
CNewbie15-Jun-05 19:32 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow16-Jun-05 2:56
David Crow16-Jun-05 2:56 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie16-Jun-05 5:30
CNewbie16-Jun-05 5:30 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow16-Jun-05 5:43
David Crow16-Jun-05 5:43 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie16-Jun-05 5:54
CNewbie16-Jun-05 5:54 
Actually I am using MFC. "CDialog" is a ficticious name.

As I pointed out in the last post, I declared both of the arrays in my header file as such:

<br />
	void (*call_cmd_function[160])();<br />
	void (*call_ins_function[48])();<br />


Then I defined them "globally" at the top of one of my source files as such:

<br />
        void (CflowlogDlg::*call_ins_function[48])() = {NULL};<br />
        void (CflowlogDlg::*call_cmd_function[160])() = {NULL};<br />


As you said without the "extern" keyword this would not be seen within all of my source files. The wierd thing is that I reference these arrays in more then one of my source files and the compiler didnt give me any errors when compiling with this code.

Now I do define these arrays in my InitDialog() as such:

<br />
	CflowlogDlg INSFunction;<br />
	INSFunction.call_ins_function[0] = &CflowlogDlg::doins00;<br />
	INSFunction.call_ins_function[46] = &CflowlogDlg::doins5C;<br />


but when I get to reference the array in another member function it is not defined. Instead of the array having the function addresses in them they have the default memory address of 0xCCCCCCCC in them. The definition only works if i put the definition of the arrays in the same member function as the one I reference them from. Now obviously I am doing something wrong here, but i do not know what
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow16-Jun-05 6:11
David Crow16-Jun-05 6:11 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie16-Jun-05 6:13
CNewbie16-Jun-05 6:13 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow16-Jun-05 6:21
David Crow16-Jun-05 6:21 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie16-Jun-05 6:34
CNewbie16-Jun-05 6:34 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow16-Jun-05 7:06
David Crow16-Jun-05 7:06 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie16-Jun-05 7:46
CNewbie16-Jun-05 7:46 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow16-Jun-05 8:24
David Crow16-Jun-05 8:24 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie16-Jun-05 8:46
CNewbie16-Jun-05 8:46 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow16-Jun-05 8:49
David Crow16-Jun-05 8:49 
GeneralRe: C++ Array Of Function Pointers problem Pin
coadtoad13-Jun-05 6:23
coadtoad13-Jun-05 6:23 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie13-Jun-05 11:49
CNewbie13-Jun-05 11:49 
GeneralRe: C++ Array Of Function Pointers problem Pin
coadtoad14-Jun-05 5:58
coadtoad14-Jun-05 5:58 
GeneralAccess variables in CMyView Pin
hcmuns12-Jun-05 17:26
susshcmuns12-Jun-05 17:26 
GeneralRe: Access variables in CMyView Pin
PJ Arends12-Jun-05 17:38
professionalPJ Arends12-Jun-05 17:38 
GeneralRe: Access variables in CMyView Pin
hcmuns12-Jun-05 17:49
susshcmuns12-Jun-05 17:49 
GeneralRe: Access variables in CMyView Pin
Tom Archer12-Jun-05 18:22
Tom Archer12-Jun-05 18:22 
GeneralRe: Access variables in CMyView Pin
hcmuns12-Jun-05 21:21
susshcmuns12-Jun-05 21:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.