Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / memory problems (driving me crazy)

Author
Message
Tommy S
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location:
Posted: 4th Jun 2005 01:13
this code is meant to read a memory address from a file and make a pointer to it so that i can use call dll and return data from c++. Thats the plane anyway and my c++ is pretty shocking, if anyone can help it would be greatly appreciated.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 4th Jun 2005 01:23
Why not allocate memory in one part and pass it to another ? Storing it in a file is just asking for trouble.

So it would be something like :

ptr=make memory(1024)
call dll 1,"flibble",ptr,17

And in the DLL you would have

void flibble(DWORD ptr,int value)
{
*(DWORD) ptr=(DWORD) value;
}

Tommy S
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location:
Posted: 4th Jun 2005 01:34
the problem is i will be allocating the memory in a dll already attached to one program and trying to acess it from another dll attached to dbpro. That was the reason for the file in the middle. If there's a way to get rid of it then that'd be great
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Jun 2005 03:04
Stop! You cannot do this.

Memory addresses are private to the process that has allocated the memory. You cannot share like this.

You have two options:

- Use memory mapping to share the file contents (you access it using memory addresses, not file I/O)

- Use memory mapping to share a portion of the swap space.

If you don't need to keep the data permanently, then the second option is the one to go for.

http://docs.rinet.ru/VidimyyC/vcu13fi.htm#I24

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
Tommy S
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location:
Posted: 4th Jun 2005 19:16
sorry to be a pain in the arse but that went straight over my head. Could you show me some code?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Jun 2005 19:36
Yes ... http://docs.rinet.ru/VidimyyC/vcu13fi.htm#I24

Sorry, but the # stops me making it a proper link.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 5th Jun 2005 15:38
filemapping is nice and easy to use

formerly shadows of emptiness

Login to post a reply

Server time is: 2024-11-21 14:02:03
Your offset time is: 2024-11-21 14:02:03