Click here to Skip to main content
15,921,622 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow13-Jun-05 3:16
David Crow13-Jun-05 3:16 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie13-Jun-05 5:08
CNewbie13-Jun-05 5:08 
GeneralRe: C++ Array Of Function Pointers problem Pin
David Crow13-Jun-05 5:17
David Crow13-Jun-05 5:17 
GeneralRe: C++ Array Of Function Pointers problem Pin
CNewbie13-Jun-05 5:39
CNewbie13-Jun-05 5:39 
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 
Hey David. i just wanted to update you on my Function Pointer array problem.

I have solved the problem of the arrays not being initialized by filling them within a member thread using an instance of my class as such:

CDialog Function;
Function.call_function[0] = &CDialog::dFunction1;
Function.call_function[1] = &CDialog::dFunction2;

However, these are only Local definitions and would need to be redefined whenver this function is called. So what I would rather do is define them globally, but I have not been able to figure out how to do it without error.

According to books I read. To declare instances (objects) of a class, you do so by including them at the end of the class declaration outside of the ending curly bracket. I did this using the "extern" keyword so the object could be used throughout all of my source files as such:

<br />
class CDialog<br />
{<br />
       public:<br />
             CDialog(CWnd* pParent = NULL);	// standard constructor<br />
       protected:<br />
             virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support<br />
       protected:<br />
                 // Generated message map functions<br />
                 virtual BOOL OnInitDialog();<br />
                 DECLARE_MESSAGE_MAP()<br />
       public:<br />
       CEdit m_sigstrEdit;<br />
}extern Function;<br />


I then defined the instance globally in one of my source files as such:

CDialog Function;

and it compiled without syntax error, but as soon as the program starts I get an assertion error in Line 26 of afxwin1.inl. If I do not use the "extern" keyword i get linker errors about the object already being defined. So I am at a loss about how to implement this globally.

I really appreciate your help thus far.
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 
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 

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.