How do I pass a memory pointer between DLLs?

S

soxmax

I am working with very limited memory so I thought I would allocate
all the memory I would need in my top level DLL and then pass a
pointer to the other DLLs so they could use the same allocated memory.
It crashes the application. From primitive debugging I find that the
pointer gets Nulled when I pass it. System status shows that the
memory is still allocated but the pointer is not being passed
properly. How do I fix this?

Adieu,
Derek
 
M

Me

I am working with very limited memory so I thought I would allocate all
the memory I would need in my top level DLL and then pass a pointer to
the other DLLs so they could use the same allocated memory. It crashes
the application. From primitive debugging I find that the pointer gets
Nulled when I pass it. System status shows that the memory is still
allocated but the pointer is not being passed properly. How do I fix
this?

Adieu,
Derek


I rarely ever write this because I think some of the regulars go overboard
in how often they say "OT"...but, ask in a windows forum where you'll get
a real answer because your question is platform specific and has
absolutely nothing to do with C++.
 
S

soxmax

I rarely ever write this because I think some of the regulars go overboard
in how often they say "OT"...but, ask in a windows forum where you'll get
a real answer because your question is platform specific and has
absolutely nothing to do with C++.

Sorry about that. Thanks. I don't know what "OT" means so I'm glad you
didn't write it.
 
G

Gianni Mariani

soxmax said:
I am working with very limited memory so I thought I would allocate
all the memory I would need in my top level DLL and then pass a
pointer to the other DLLs so they could use the same allocated memory.
It crashes the application. From primitive debugging I find that the
pointer gets Nulled when I pass it. System status shows that the
memory is still allocated but the pointer is not being passed
properly. How do I fix this?

When you say "i would allocate", what does the code look like ?

When you say "pass a pointer to other DLL's" what does that code look like ?

DLL or not, it should not be an issue.
 
R

red floyd

soxmax said:
Sorry about that. Thanks. I don't know what "OT" means so I'm glad you
didn't write it.

"OT" means "Off Topic".

And even though you were off topic this time, please ask C++ language
related (not platform related) question here. You might want to lurk a
while and read the FAQ (http://www.parashift.com/c++-faq-lite) to get a
feeling for how things work here.

In general, if the answer to the question would be not applicable in
another language, and it would be the same regardless of
platform/compiler (e.g. the same on Windows and Linux) then you're on
topic here.

If your answer would be the same regardless of language (e.g. C++ or C#
or VB), or not applicable to some platform (e.g. DLLs are Windows only),
then you're probably off-topic here.

A good list of potential newsgroups can be found in FAQ 5.9 (follow the
URL above).
 
X

Xavier Serrand

soxmax said:
I am working with very limited memory so I thought I would allocate
all the memory I would need in my top level DLL and then pass a
pointer to the other DLLs so they could use the same allocated memory.
It crashes the application. From primitive debugging I find that the
pointer gets Nulled when I pass it. System status shows that the
memory is still allocated but the pointer is not being passed
properly. How do I fix this?

Adieu,
Derek

one way, you have to use shared memory. in order to create a shared memory
zone, see your system specific help.
one another way, use a class defined in your DLL in order to access to your
memory from other process.
the second way is like... doing again shared memory API...

Xavier Serrand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top