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 / storing data in a dll for return later

Author
Message
mm0zct
21
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 14th Apr 2005 03:14 Edited at: 14th Apr 2005 03:15
i am writing a simple physics dll but my problem is returning all 6 floating point velocities to dbp

i have the results of the calculation stored in global variables in the dll and a seperate function to return each result to dbp, however they just return zero as if the contents was lost when the second function was called.
if i replace the variable with an actual value it returns that value and there is no reason my algorithm should return zero.

how do i retain the values in the dll or how do i get all the data back to dbp (eg how can i make it pass pointers to the dll instead of variable values)

any help appreciated and thanks in advance.

edit for typo

http://www.larinar.tk
AMD athlon 64 3000+, 512mb ddr400, abit kv8, 160gb hdd, gigabit lan, ati radeon 9800se 128mb.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 14th Apr 2005 04:01
The best way would be to allocate an area of memory (say 6*sizeof(float)) when the DLL initialises, de-allocate it when the DLL is destroyed and store all results within this area of memory.

You would return the allocated area of memory back to DBPro, from which it would have to get the results out it.

Visit http://homepages.nildram.co.uk/~nickk
Bill Nighy - The Doctor for me...
mm0zct
21
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 14th Apr 2005 05:19 Edited at: 14th Apr 2005 05:30
thanks, how would i go about doing this, momory allocation isn't something i've covered in c++ and the same goes for accessing it from dbp.
any tips while i search for tutorials?

edit ok i think i've found a way but how big is a standard float in dbp in bytes? i can't find ti in the help docs

http://www.larinar.tk
AMD athlon 64 3000+, 512mb ddr400, abit kv8, 160gb hdd, gigabit lan, ati radeon 9800se 128mb.
Cryptoman
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 14th Apr 2005 05:50
single precision is 4 double is 8


mm0zct
21
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 14th Apr 2005 07:15
thanks

http://www.larinar.tk
AMD athlon 64 3000+, 512mb ddr400, abit kv8, 160gb hdd, gigabit lan, ati radeon 9800se 128mb.

Login to post a reply

Server time is: 2024-11-21 15:16:51
Your offset time is: 2024-11-21 15:16:51