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

Just starting out? Need help? Post your questions and find answers here.
spacefractal
User
User
Posts: 17
Joined: Tue Jan 24, 2006 7:05 pm

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

Post 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?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

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

Post 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.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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?
I may look like a mule, but I'm not a complete ass.
spacefractal
User
User
Posts: 17
Joined: Tue Jan 24, 2006 7:05 pm

Post 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
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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?
I may look like a mule, but I'm not a complete ass.
spacefractal
User
User
Posts: 17
Joined: Tue Jan 24, 2006 7:05 pm

Post 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!
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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
I may look like a mule, but I'm not a complete ass.
spacefractal
User
User
Posts: 17
Joined: Tue Jan 24, 2006 7:05 pm

Post 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?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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!
I may look like a mule, but I'm not a complete ass.
Post Reply