Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - data sharing(incuding std::any) between program and dynamic library through dlopen: (1 Item)
   
data sharing(incuding std::any) between program and dynamic library through dlopen  
HI, 
I am facing an issue with std::any in a data structure that shared between a program and a dynamic library loaded 
through dlopen()
Here are a little bit of details of the issue:
1. I have a program(Program_a) that created a global data storage definde as a class. One of the elements of the storage
 is defined as std::any. 
2. The program loads a dynamic shared library b.so at runtime which also access to the data storage and save some data 
in the storage including the element(c) defined as std::any.
3. When using an API to access the element(c) from context of  Program_a, I got bad any_cast error. 
4. By looking into the memory of element(c), it contains 16 bytes, the first 8 bytes looks like a memory pointer in 
stack of (b.so), the last 8 bytes contains the actual data that added by b.so. The data storage seems to have a memory 
address from a heap. 

The same program runs fine on Ubuntu machine. The problem only showed up when running on QNX target.

Any idea what happened here?