I found the answer.Here's my latest work around:
I havewas searching for a work around. I got back to use this configurationcopy a method of casting a function pointer.
And changed my data structure of having 2 nested structs to one that contain everything which should serve my project well.
Here's my work:
task_manager.h
#include<stdio.h>
#include<stdlib.h>///////////////////////////////////////////////////////////////////////////
#include<string.h>// enumerations
#include<stdint.h>typedef enum {NOT_FINISHED,FINISHED,DONE}STATE;
// variables
uint8_ttypedef void (*fun_ptr*f_ptr)(void *args);
uint8_t// read_chars(uint8_tstructs
typedef addressstruct __attribute__((__packed__)) THREAD{
uint8_t i;
tsk_cnts, tsk_cntr; uint8_t *array_address;// task information
iSTATE = address;
thrd_st; printf("address of array is 0x%.2x\n",i); // thread flag states
returnf_ptr 0x0a; *tsk_fptr;
}THREAD;
main.c
#include <stdio.h>
uint8_t#include write_chars(uint8_t<stdlib.h>
#include row,<stdint.h>
#include uint8_t"task_manager.h"
const col,unsigned char *str){
PIC[] = {9, 8, uint8_t7, i;
1, 2};
void function1(void){printf("function1\n");}
void function2(uint8_t i){printf("function2\nnumber = strlen(str%d\n",i);}
void function3(uint8_t a, printf("sizeuint8_t ofb, stringconst isuint8_t %d\n",i*img);{
printf("%s\n""function3\na#%d b#%d\narray[0] = %d\n",stra,b,*(img+0));}
uint8_t function4(uint8_t i){printf("function4# return\n"); return 0;
i+=1;}
THREAD thread1;
uint8_t fn4_ret;
int main(){
uint8_t// add_val;set thread main info
thread1.thrd_st = 0;
thread1.tsk_cnts = 4;
fun_ptrthread1.tsk_cntr = 0;
// allocating memory for tasks
thread1.tsk_fptr = malloc(4*sizeof(f_ptr));
// store tasks addresses
thread1.tsk_fptr[0] = (void(*)())read_chars;function1;
add_valthread1.tsk_fptr[1] = fun_ptr(1void(*);())function2;
thread1.tsk_fptr[2] = (void(*)())function3;
fun_ptrthread1.tsk_fptr[3] = (void(*)())write_chars;function4;
fun_ptr// call the functions
((void(*)())thread1.tsk_fptr[1])(9);
((void(*)())thread1.tsk_fptr[2])(1,2,PIC);
fn4_ret = ((uint8_t(*)())thread1.tsk_fptr[3])(1);
printf("\fn4_ret = %d\n","messaage1"fn4_ret);
return 0;
}
I used itIt compiled with two types of functionsme fine, passed what I want and it workedreturned the required data.