Page 1 of 1

Call a Dll crash on Win 98 (but work on XP)

Posted: Tue Feb 14, 2006 10:33 pm
by spacefractal
I'm Trying to call a dll, that parse a string to a dll, but it allways crash on win 98 (but work fine on XP).

Here the Purebasic code:
; PURE BASIC CODE
ProcedureCDLL.l BASS_OpenFile(filename$)
.....
ProcedureReturn result.l
EndProcedure
Here is the code, Im trying to call from blitz+:

Code: Select all

HANDLER=JUKEBOX_OpenFile(FILE$)
When using a string pointer and peeks it (in purebasic dll), it didden't help.

It crash with this message:

BLITZCC caused an invalid page fault in
module KERNEL32.DLL at 0167:bff9da1a.
Registers:
EAX=005a000c CS=0167 EIP=bff9da1a EFLGS=00000206
EBX=00d3f7a0 SS=016f ESP=0059fef0 EBP=005a0010
ECX=0059ffbc DS=016f ESI=005a0118 FS=3787
EDX=005a0030 ES=016f EDI=005a0030 GS=0000
Bytes at CS:EIP:
50 51 ff 75 08 8d 85 e0 fe ff ff 50 ff 75 0c e8
Stack dump:


NB. I have no problems with vareiables alone, only strings problems (can it acour in the newest officel version and 4.0Beta 2.

Nb. I do not know the bug is in Blitz or Purebasic?

Re: Call a Dll crash on Win 98 (but work on XP)

Posted: Tue Feb 14, 2006 10:42 pm
by Trond
spacefractal wrote:Nb. I do not know the bug is in Blitz or Purebasic?
Then you make a program in PB which calls the dll. If it still doesn't work on Windows 98 it's not Blitz.

Posted: Tue Feb 14, 2006 11:00 pm
by srod
Could try stripping out the 'guts' of the exported procedure and leave it simply returning a default value of, say, 1 without doing any parsing. See if this still crashes?

Posted: Tue Feb 14, 2006 11:23 pm
by spacefractal
if it ....., it just here to explain out, and have nothing to due to the codning.

I have even trying parsing this, without luck:


ProcedureCDLL.l BASS_OpenFile(filename$)
EndProcedure

Posted: Tue Feb 14, 2006 11:34 pm
by srod
I've had this problem myself, program crashing on win98 but not xp. It turned out to have everything to do with my coding and the way that win98 frees up it's allocated memory. Unless you post a little more of the PB code though, then there's probably little chance of anyone shedding any light on the matter. :)

**Edit: sorry, have just read your last post properly! Doh! If the two line procedure crashes, then that is weird. I presume that if you were not using the correct calling convention, then it would crash on xp also?

Posted: Tue Feb 14, 2006 11:43 pm
by spacefractal
Yep it really really weild and seen to a big bug in Pure Basic, what should been fixed soon!

It Does NOT crash in XP and pass the string very fine and works!

Posted: Wed Feb 15, 2006 12:01 am
by srod
I was just browsing some Blitzbasic docs

http://www.blitzbasic.com/sdkspecs/sdks ... _specs.txt

It says:
All functions MUST use the _stdcall calling convention.
If this is up to date, then you should change your Purebasic function declaration to

Code: Select all

ProcedureDLL

Posted: Wed Feb 15, 2006 3:12 pm
by spacefractal
it seen ProcedureDLL works, but I just remembed this one has crashed too, but I have have the test matial like now (I got Win 98 installed on Vmware, wich took some time to get soundcard to work).

But it still wierd why it didden't crash on Windows XP?

Posted: Wed Feb 15, 2006 3:40 pm
by srod
I think that's part of xp's stability rather than win98's fragility. If indeed the problem related to calling conventions, then on exiting the dll procedure, the stack would not be 'cleaned up' properly. Subsequent errors then depend upon exactly what your code was doing next etc. E.g. nested procedure calls would be quite disastrous!