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 / No work my function, any suggestions?

Author
Message
skully
17
Years of Service
User Offline
Joined: 21st Jul 2006
Location: y+width*x
Posted: 21st Mar 2009 00:52

Hello, I made a \"DLL\", but will not work for me this funtion, know the problem, comment lines \"/ /\" are responsible for the malfunction, any suggestions? AH!!! What is decorated with the names of the functions? I can not find the \"object exist\" in \"DBProBasic3DDebug.dll\" not meeting \"image existed\" and \"sprite exist.\" I found only \"memblock exist\"=?MemblockExist@@YAHH@Z (PERFECT WORK)

p.d. I have the \"SDK\", \"DarkBasic Pro\" and work with \"Visual C++ standard\" is certainly no errors in the compilation.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Mar 2009 12:13
pString may be a null pointer - you access it in places where you haven't tested for this.

pNewString IS a null pointer - you never allocate any memory for it. When you fix that, remember to free that memory when you are done.

skully
17
Years of Service
User Offline
Joined: 21st Jul 2006
Location: y+width*x
Posted: 21st Mar 2009 21:14
thank'u thank'u thnak'u^infinite


Is true, i long time no programmer, is that...

Now my function work perfectly... Aahhh i found the names decorate...



p.d. Apologize my english, is no good...
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Mar 2009 01:19
No. This will not copy your original string - it will copy the pointer to the string. That's a bad thing to do as your code will change the original string later:


Instead, use something like strdup() to create a copy and then free() to release the memory at the end:


skully
17
Years of Service
User Offline
Joined: 21st Jul 2006
Location: y+width*x
Posted: 22nd Mar 2009 21:47
HI!!

I knouuuwww, but I swear that my code works well, however these lines incorporate to my code, I did not know it existed "strdup" ?¿ ... yes, and I will put the function "free" to my "free" function, (word redundancy) ah, I ask you now to take...
I can use a global pointer to the DLL? I tried but I can not, it works, but when my function is trying to increase the value of this pointer, is not increased ... keeps the same value when called the first time .. (win a present if you understand what I write, sorry)

thank for reply "Ian"

WhiteSkull
skully
17
Years of Service
User Offline
Joined: 21st Jul 2006
Location: y+width*x
Posted: 25th Mar 2009 16:37
hi! I have another question, when I call the "intersect object" does not work, I rarely returns a value, the same value that returned "object size", the value is always the same "-1.#IND" I do something wrong, but know that ... this is part of my code:



one of my functions use maths in this case "sin" and "cos" (math.h), with degrees, funny or not, the result of "sin" of the DBpro is different, and I had to remedy that divide by 57.3 degrees so that the result was equal to that of DB ... why that?

And to end, once compiled does not work "strupr" (no strup) and "free", the DB application is broken, so I left my code as before ... thank you and look forward to an answer.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Mar 2009 23:35
I don't use those functions: ?GetYPosition@@YAMH@Z
Instead, I use these: ?GetYPositionEx@@YAKH@Z

The return value is a DWORD, but can be converted like so:


The C library maths functions don't accept degrees - they use radians. The 57.3 you use is approximately the value needed to convert from degrees to radians. The correct conversion should be:

Radians = Degrees * PI / 180

skully
17
Years of Service
User Offline
Joined: 21st Jul 2006
Location: y+width*x
Posted: 27th Mar 2009 14:53
IAN!! you are a bad person!! I have discovered, today at 12 and 39 (PM -GMT), and when I was about to post... is joke, I guess you were busy all contestant in the forum... but do not know the rage, the truth is that it was a very stupid bug ... thanks Ian, you're a friend



see you, thank you can close the thread...

WhiteSkull

Login to post a reply

Server time is: 2024-03-28 22:43:14
Your offset time is: 2024-03-28 22:43:14