triumphost 120 Posting Whiz

I just started shared memory and I took a big dive into it and got stuck trying to figure out how to share pointers. Well not really pointers:

void* pData = MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, MapSize);

Ok so the above holds my view of the file to be shared between 2 DLL's.

The first is to be attached to a proccess and creates the mapping. <-- This DLL gives the Second one all info it collected.

The Second DLL is a plugin for a pascal program that will read the data and use it.
It exports functions like this:
"Function GetViewPort(var X, Y, Width, Height: Integer): Boolean;"

Now the data for that function is retrieved from the Second DLL:

DLL_EXPORT bool GetViewPort(int &X, int &Y, int &Width, int &Height)
{
    int* Data = static_cast<int*>(pData);
    Data[0] = GLHook_ViewPort;

    if (SharedDataFetched)
    {
        X = Data[1];
        Y = Data[2];
        Width = Data[3];
        Height = Data[4];
        return true;
    }
    return false;
}

And that all works fine. However, for a function defined like this:
void* GetModels() is supposed to return a vector of structs.

It is defined as:
Function GetModels(): Integer;

Where the integer is just a pointer. How can I pass a vector of structs from the First DLL to the Second using the memorymapfile? I know I'll have to pass the size but how can I pass the actual info to the first DLL? If I pass &Vector[0] then how would my pascal program be able to retrieve the data the the DLL gave it? If it's a 2D vector, how would it iterate that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.