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 / Question for TCA

Author
Message
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 20th Oct 2004 08:07
Hi,

I have been using some of your great plugins, for different tasks in my program. I notice how many of the functions contained in them take a ptr to memory made with the MAKE MEMORY command. Is it complex to modify this data within the dll and return the pointer?, also what is the argument type in c++ for the pointer.

Thanks, Mnemonix.

Oh yea, i tried looking at your source code on your website, but it was quite complex.

The 3d chat is coming...
In the meantime, come in the IRC. Ask me for details!!.
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 20th Oct 2004 08:12
Which ones are you enquiring about ? Usually modifying data passed is easy (the mySQL is slightly harder, but thats only due mySQL stuff).

For C++ your supposed to use new to allocate memory (as it can correctly allocate memory for classes), although I still tend to use malloc/calloc.

The pointer type stays the same, so its :

*ptr=new char[1024];

and

*ptr=(char *) calloc(1024);

are for all purposes more or less the same.


UK Convention : 23/24th of October. Only a few days to go!
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 20th Oct 2004 08:14
I mean in DBP, when you use

ptr=MAKE MEMORY(1024)
myTPC(ptr)

Now, how can i get hold of the data stored at the ptr in c++, and is it possible to modify it?

The 3d chat is coming...
In the meantime, come in the IRC. Ask me for details!!.
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 20th Oct 2004 17:11
Well, in the C function it would be passed into a DWORD, thus :

myTPC(DWORD addr)

Depending on the type, it could be converted to a string or some other pointer :

str=(LPSTR) addr;

and then modified as usual using :

*(str)=(char) 'A';

If it requires some other type its just as easy :

ptr=(MYSQL *) addr;
ptr->wibble=27;

If you want to keep it as a list of array pointers :

ptr=(DWORD *) addr;
*(ptr)=12;

The important thing is the use of pointers to modify the data. It doesn't have to be complex but its certainly needed.*


*Not always - you can use the code for the peek/poke commands, but that usually makes it more complex.


UK Convention : 23/24th of October. Only a few days to go!
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 21st Oct 2004 02:19
Thank you!. This should be all I need .

The 3d chat is coming...
In the meantime, come in the IRC. Ask me for details!!.
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 21st Oct 2004 17:04



UK Convention : 23/24th of October. Only a few days to go!

Login to post a reply

Server time is: 2024-03-29 00:23:48
Your offset time is: 2024-03-29 00:23:48