Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to call function from another process using QSharedMemory

Tags:

c++

qt

I know it is possible to share variables through shared memory, is it possible to put a function pointer to a shared memory from process A and from process B get it and call as function?

I don't really find a specific answer to this question in docs.

thanks in advance

like image 924
user1077063 Avatar asked Jan 24 '26 12:01

user1077063


1 Answers

No, it's not possible. Pointers are only meaningful in the address space of the process. You need some form of message passing to trigger the function call on the other side. To avoid bloat, you can do the following: Since Qt slots can be invoked dynamically (i.e. called by knowing their name as a string and their parameter types), you can pass a message to a dispatcher function that parses the message and invokes the slot dynamically.

like image 89
Tamás Szelei Avatar answered Jan 26 '26 02:01

Tamás Szelei