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.

DarkBASIC Professional Discussion / Problem when I call a simple dll

Author
Message
XANAX 2B
23
Years of Service
User Offline
Joined: 20th Jun 2003
Location: Corsica (France)
Posted: 5th Jul 2003 14:12
Hello Everybody !

I have a problem when I call a dll i've made. (It's a dll wich just call windows API to show a "save as" or "open" window, and let me get in DBPro the name of the file to load/save)
When I use it for the first time and load a file, all works but when I load a file for the second time, DBPro crash, and sometimes say that "core" has crashed.

Need help
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Jul 2003 14:38
It's all down to the area that your string is pointing to not being large enough to hold the data you are trying to put in it.

Try changing this line:
local ThisName$=""

For this:
local ThisName$=space$(1024)

See if it works for you.
XANAX 2B
23
Years of Service
User Offline
Joined: 20th Jun 2003
Location: Corsica (France)
Posted: 5th Jul 2003 16:26
I've tryed that, but nothing changes. The thing wich is strange is that when I save a file, there is never a problem. And when I load a file, the first time, all works, and when I try to load a second music, it fails. If I just call the dll to get the name without loading the file, it's the same thing, it's crashes at the second or the third time. I think there are two possibilities :

1) May be there is a problem in the line where I call the dll (because there is only one parametre wich is passed to the dll and it's the same parametre to get the name, I don't know if that works well).

2) I'm a new C programmer, so, may be I've forgotten to do something in the dll... If someone have the knowledge in C to help me ...

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Jul 2003 16:41 Edited at: 5th Jul 2003 16:42
Try changing your functions like this:



call it like this:
ThisName$=call dll(1,"_GetFileName1")

I admit to it being a long time since I wrote an old-style DLL I stick to TPC DLL's now - much more user-friendly
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 5th Jul 2003 16:45
I've got a plug-in for the load/save dialog window by the way.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins and other exciting things - oh my, yes!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Jul 2003 16:52
I thought that you might have one somewhere
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 5th Jul 2003 16:59
Ensure that you are using the cdecl calling convention as well.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_103.zip
XANAX 2B
23
Years of Service
User Offline
Joined: 20th Jun 2003
Location: Corsica (France)
Posted: 5th Jul 2003 18:11
Thanks a lot !

Finally, I've found the bug, you'll be surprised :
When you put any REM commands around some variables, DBPro compileur bugs !
I've discovered that when I've tried to write some text with some variables. Two variables have been swaped. And I've remembered that sometimes, DBPro do mistakes when whe put REM commands around other commands. I've deleted all my REMs around my variables and Miracle !
The text bug and the call dll bug have disapeared !
Whe must report that bug to DBTeam !
Bye

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Jul 2003 19:11
Aha, I hardly ever put rems in to describe my variables - I use descriptive names in the first place

Rob, the cdecl is the default convention for C ... C DECLaration

Login to post a reply

Server time is: 2026-07-17 13:57:22
Your offset time is: 2026-07-17 13:57:22