0 Members and 3 Guests are viewing this topic.
typedef struct _rshellAPI{ void (*c_draw)(void); void (*c_clear)(void); void (*c_writec)(char ch); void (*c_write)(char* str); void (*c_swrite)(char* format, int buflen, ...); char (*cn_readc)(void); char (*c_readc)(void); int (*c_read)(char* str);} rshellAPI;
rshellAPI rshell ={ &c_draw, &c_clear, &c_writec, &c_write, &c_swrite, &cn_readc, &c_readc, &c_read};
((void (*)(int, char **, rshellAPI*))(docptr + sizeof(PRGMSIG)))(n_argc, n_argv, &rshell);
int main(int argc, char** argv, rshellAPI* rshell)
rshell->c_writec('\n');
Error at PC=11140B6C: Unaligned read_word: 11 Backtrace:Frame PrvFrame Self Return Start11136665: 41000000 3A41003A 003E7325 000A0D2041000000: invalid address
Do function pointers work properly in the Ndless toolchain? I remember they didn't at some point. What are the GCC options in your makefile?
n_argc=1, n_argv=1800e070, &rshell=111B0400
argc=1, argv=1800e070, rshell=00000001
n_argv[19] = (char*)&rshell; // put pointer in last array slot
int main(int argc, char** argv){ rshellAPI *rshell; rshell = (rshellAPI *)argv[19]; ...}
Launcher: 1800e93cLaunched: 111793a8
First of all, thanks for your help.Currently I'm not at home, but how do I have to call nl_relocdata() with a structure?What is the first argument (nl_relocdata_data on Hackspire)?