• Advertisement
Sign in to follow this  

dll communication

This topic is 3895 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a program dynamically loading a dll. Now I call a function of the dll and pass a pointer from the application as a parameter. So this means I want the dll to access data stored in the application via a pointer. My app is crashing and Im starting to think that maybe this just isnt possible. Anyone know whats going on? Did I do a programming mistake or is this setup not possible? Alternatives (return values are really not an option and Id really not like to copy all the data). -CProgrammer

Share this post


Link to post
Share on other sites
Advertisement
A DLL will occupy the same memory as the process it's loaded into - that means you can pass pointers around and they should work. You only have to worry about copying the entire data structure when you pass data between processes.

One thing to be careful of is global variables - if you have any 'shared' code files that have global variables, the EXE will get one real variable and the DLL will get another, and the code in either will access their own copy rather than the one in the EXE.

It's likely that there is a small bug of some other kind which is causing the crash...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement