Click here to Skip to main content
15,794,275 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have an ext dll which has a base class, It has been simplified so could see what going on Header file defined as
#include "CmnStruct.h"
class B10 CBYetiBase : public CmnStruct
	// main app/errcontrol
	YVoid CreateErrControlStruct(sAppParam *sParams, PROTO_ERR_CODES);

in Source Code
YVoid CBYetiBase::CreateErrControlStruct(sAppParam *sParams, PROTO_ERR_CODES)
	FNC_INITIAL(CreateErrControlStruct); L_RET_PTRNULL(sErrControl);
	//                          ***
	int n = 0;          
	n = CmnStruct::Return();
	RETASYVOID;             //  ***

this is all thats in CmnStruct
class CmnStruct
	int Return();

int CmnStruct::Return()
	return LB_ERR;

Most of the words are defined macros and work else where when run it jumps line between marked ***

What I have tried:

Have tried making the class CmnStruct to use -> and . as function calls
the only way it works is by removing the class and putting the code directly into CBYetiBase::CreateErrControlStruct but I need to reference other functions from the Cmn class (the function used here, has been simplified)
Updated 4-Aug-23 4:56am
CPallini 4-Aug-23 5:30am    
How do you check that?
Idd Jutt 2021 4-Aug-23 8:20am    
Sorry how do I check what ?
CPallini 4-Aug-23 8:22am    
That code was actually skipped.
Idd Jutt 2021 4-Aug-23 8:23am    
single stepping after a breakpoint
CPallini 4-Aug-23 9:23am    
Such a code has no effect. It could have been optimized out.

All those macros make your code very difficult to understand. However, as far as I can see, that code will not even compile. You are trying to call a non-static class method as if it was declared static. You need to create an instance of the CmnStruct class and call Return through it, thus:
CmnStruct mystruct;
int n = 0;
n = mystruct.Return();

As per CPallini's reply below.
Share this answer
CPallini 4-Aug-23 7:55am    
Nope, it is not an attempt to call a static method.
It is a call to its own instance method (after all 'CBYetiBase' is a 'CmnStruct').
#include <iostream>
using namespace std;

class Base
int the_answer(){ return 42;}


class Derived: public Base
  Derived(){ cout << "The answer is " << Base::the_answer() << "\n";};

int main()
  Derived d;
Idd Jutt 2021 4-Aug-23 8:15am    
n = CmnStruct::Return();
I know I do not need the class specifier, I add them in for clarity
Richard MacCutchan 4-Aug-23 8:40am    
Thank you, I misread that.
Idd Jutt 2021 4-Aug-23 8:07am    
Yep already tried that, it still jumps over, and the variable n will as unrecognised, and yes do use a lot of macros, but they are mainly setting up initial values, and a return value set as a type
the solution was to put back in Debug mode, some how was in Release
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900