Link to home
Start Free TrialLog in
Avatar of sdj_work
sdj_work

asked on

Sharing data in a 32-bit dll

I have converted a 16-bit dll to 32-bit. The old dll had been written to allow data to be shared between processes. I have modified the shared data to fit inside a #pragma data_seg("shared") section. However I have a question about how this works. If I write the code like:

typedef struct mesg_type
{
  UINT num_msg;
  char mesg[MAX_LENGTH];
} mesg_type_item;

#pragma data_seg("shared")
  mesg_type_item shared_list[MAX_ITEMS];
#pragma data_seg ()

the data does not become shared. But if I do this:

#pragma data_seg("shared")
  mesg_type_item shared_list[MAX_ITEMS] = {0,""};
#pragma data_seg ()

It appears to work fine.

Any explanations?
ASKER CERTIFIED SOLUTION
Avatar of jrmcg
jrmcg

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jrmcg
jrmcg

This was taken from MSDN.

J.R.