Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8368301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:21:20+00:00 2026-06-09T13:21:20+00:00

How can I share Objects across DLL’s? Example: DLLA is loaded by Process A.

  • 0

How can I share Objects across DLL’s?

Example:

DLLA is loaded by Process A. DLL A collects data (Intercepts calls from process A).

DLLB is loaded by a Pascal program and wants to use the data that DLLA collected.

I’ve created a mapping with DLLA like so:

GL_EXTERN bool __stdcall CreateSharedMemory()
{
    if ((hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, MapSize, SharedMemoryName.c_str())) == NULL)
    {
        return false;
    }

    if ((pData = MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, MapSize)) == NULL)
    {
        CloseHandle(hMapFile);
        return false;
    }
    return true;
}

And DLLB just opens it and maps it.

They can share commands. So DLL B can give DLLA commands and retrieve data but I cannot seem to figure out how to share objects/classes/vectors across the memory.

I’ve tried using a pointer but realized that this is invalid and gives access violation errors. Also it seems to share integers fine but it doesn’t seem to be able to share floats :S How can I accomplish these tasks?

EDIT: To communicate I do:

int* Foo = static_cast<int*>(pData); where pData is the map pointer.
//Then I do:

Foo[0] = X; Foo[1] = Y;

And have the processes read and write from the corresponding values.

Info:

This is the files for DLLA: http://pastebin.com/MFkqwxJe and http://pastebin.com/MDeWprkb

This is the files for DLLB: http://pastebin.com/Uj3dijc4 and http://pastebin.com/vkDdPp7e

EDIT: Narrowed it down to: http://pastebin.com/hNF6Cu2L as requested.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:21:21+00:00Added an answer on June 9, 2026 at 1:21 pm

    In the shared memory region you can use all fundamental data types like integers and floating point numbers. If you have problems with float, this is unrelated to the shared nature of the memory, like different understanding between C/Pascal of what float/double/long_double is. You cannot use pointers. Structures that do not nave VMTs and do not have pointers are fine also. Complex data structures can be emulated using offsets (direct or indirect) from the beginning of the shared region.

    To make synchronization (like events) you can use named objects.

    You can also pass handles between processes. Check the DuplicateHandle function.

    Continuation:

        Data[3] = &ListOfModels[0];
    

    Here you put into the shared memory an address that does not belong to the shared memory region. The data in the shared memory region should be completely self contained meaning that all pieces of data should be in that region. Definition of the structure should look like:

    struct SaredData
    {
        int data_type;
        int status;
        union
        {
            struct
            {
                int       num_font_char_objects;
                FontChar  font_char_objects[MAX_FONT_CHARS_SUPPORTED];
            };
            ...........
        };
    };
    

    And you need to ensure that the size of the shared memory region is big enough to store all passed objects. It is highly unlikely that any container from STL with work with shared memory.

    You cannot place your Model structure into the union above because it contains complex fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application user can share information with different apps using: shareIntent.putExtra(Intent.EXTRA_SUBJECT, Link from
I can use ipcs(1) to list out the active shared memory objects on a
Using GCC, how can I remove a symbol from a shared object after I've
I know you can share control easily with master page. But what if I
Hope that someone can share their experience with some of the latest emerging backbone.js
Any one can share the mainfest.xml. How to set it? then can remove the
i am having an application which can share Notes to evernote,it works fine i
In a project I have a stream for users, everyone can share and comment
Can someone share their experiences with s#arp architecture. we have decided to follow mvp
I want to share the container across various layers in my application. I started

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.