Click here to Skip to main content
15,880,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Convert decimal to binary in C Pin
CPallini14-Jul-22 2:36
mveCPallini14-Jul-22 2:36 
GeneralRe: Convert decimal to binary in C Pin
sahil Ranka14-Jul-22 2:42
sahil Ranka14-Jul-22 2:42 
GeneralRe: Convert decimal to binary in C Pin
CPallini14-Jul-22 3:14
mveCPallini14-Jul-22 3:14 
AnswerRe: Convert decimal to binary in C Pin
Richard MacCutchan14-Jul-22 21:15
mveRichard MacCutchan14-Jul-22 21:15 
QuestionPrey/predator c++ project Pin
sahil Ranka12-Jul-22 0:26
sahil Ranka12-Jul-22 0:26 
AnswerRe: Prey/predator c++ project Pin
Richard MacCutchan12-Jul-22 0:29
mveRichard MacCutchan12-Jul-22 0:29 
AnswerRe: Prey/predator c++ project Pin
Greg Utas12-Jul-22 1:20
professionalGreg Utas12-Jul-22 1:20 
QuestionHow to share a pointer between an EXE and a DLL Pin
Mircea Neacsu11-Jul-22 13:50
Mircea Neacsu11-Jul-22 13:50 
Apologies if the description is long; I just want to make the question clear(er).

I have a WIN32 project in which there are some applications and some DLLs that may or may not use a framework. The framework itself is statically linked to apps and DLLs and it has an important data structure that should be unique. Currently, when a DLL is loaded it has no way of knowing if the process in which it was loaded uses the framework and if the data structure has been created or not.

If DLL uses the framework and the EXE doesn't, the DLL can initialize the data structure and all is fine.
If the EXE uses the framework and the DLL doesn't, the EXE will initialize the structure and all is fine again.

The problem appears when both the DLL and the EXE use the framework and only the EXE should initialize the structure and the DLL should just somehow find the address and use the data structure.

I know I could use a shared memory area but this is not inter-process communication so I'd rather use something simpler. I even thought of setting an environment variable with the address of the structure but somehow the solution seems cheesy.

Do you have any suggestion? Is there any standard/better way of doing this?
Mircea

QuestionRe: How to share a pointer between an EXE and a DLL Pin
CPallini11-Jul-22 20:12
mveCPallini11-Jul-22 20:12 
AnswerRe: How to share a pointer between an EXE and a DLL Pin
Mircea Neacsu12-Jul-22 4:01
Mircea Neacsu12-Jul-22 4:01 
GeneralRe: How to share a pointer between an EXE and a DLL Pin
Victor Nijegorodov12-Jul-22 6:22
Victor Nijegorodov12-Jul-22 6:22 
GeneralRe: How to share a pointer between an EXE and a DLL Pin
Mircea Neacsu12-Jul-22 7:52
Mircea Neacsu12-Jul-22 7:52 
GeneralRe: How to share a pointer between an EXE and a DLL Pin
Victor Nijegorodov12-Jul-22 8:04
Victor Nijegorodov12-Jul-22 8:04 
QuestionRe: How to share a pointer between an EXE and a DLL Pin
JudyL_MD12-Jul-22 11:31
JudyL_MD12-Jul-22 11:31 
GeneralRe: How to share a pointer between an EXE and a DLL Pin
Mircea Neacsu12-Jul-22 12:17
Mircea Neacsu12-Jul-22 12:17 
GeneralRe: How to share a pointer between an EXE and a DLL Pin
JudyL_MD12-Jul-22 13:29
JudyL_MD12-Jul-22 13:29 
AnswerRe: How to share a pointer between an EXE and a DLL Pin
Graham Breach11-Jul-22 20:30
Graham Breach11-Jul-22 20:30 
AnswerRe: How to share a pointer between an EXE and a DLL Pin
Gerry Schmitz12-Jul-22 6:57
mveGerry Schmitz12-Jul-22 6:57 
QuestionVC++/MFC Pin
Member 1486933911-Jul-22 8:22
Member 1486933911-Jul-22 8:22 
AnswerRe: VC++/MFC Pin
Dave Kreskowiak11-Jul-22 9:55
mveDave Kreskowiak11-Jul-22 9:55 
AnswerRe: VC++/MFC Pin
Victor Nijegorodov11-Jul-22 9:56
Victor Nijegorodov11-Jul-22 9:56 
GeneralRe: VC++/MFC Pin
Member 1486933912-Jul-22 20:45
Member 1486933912-Jul-22 20:45 
QuestionRe: VC++/MFC Pin
Richard MacCutchan12-Jul-22 21:42
mveRichard MacCutchan12-Jul-22 21:42 
GeneralRe: VC++/MFC Pin
Victor Nijegorodov13-Jul-22 0:22
Victor Nijegorodov13-Jul-22 0:22 
AnswerRe: VC++/MFC Pin
Gerry Schmitz11-Jul-22 12:21
mveGerry Schmitz11-Jul-22 12:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.