How to return an array of structs to Console Application from Class Library

I have a Structure :-

Test.h

typedef struct employees
{
    char* name[5];
    int empi_id;
};

Test.cpp
I created a function where I need store the values within these structure.

int Disp()
{
    employees e[5];
    e[0].empi_id=10;
    e[1].empi_id=100;
    e[2].empi_id=500;
    e[3].empi_id=1000;
    e[4].empi_id=5000;
    return 0;
}

TestDll.cpp Console Application:

void main()
{
    LoadLibrary(("TestDll.dll"));

    int obj = Disp();
}

I need to return these array of structure to my Console Application.I want to display the assigned values in my Console Application directly.How Should I return it?Can I send these array of structure as a function parameter then how should I do it.Since I need to send an array of 5.
Checking out the below link did gave me an idea of assigning the values to the structure but I cant display the values in my Console App.
return an array of structs or an array of struct pointers?


Source: dll

Leave a Reply