32 to 64

New to FreeBASIC? Post your questions here.
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: 32 to 64

Post by dodicat »

integer goes to long
uinteger goes to ulong
(as suggested already)

also any pointers (uinteger ptr) to (ulong ptr), especially for graphics.
however things like screeninfo x,y -- x and y remain integers.
also imageinfo.
opicard
Posts: 81
Joined: Feb 26, 2008 16:40

Re: 32 to 64

Post by opicard »

caseih wrote:When you say, "same result" do you mean a crash? Please be specific. There are lots of definitions of "it doesn't work." You said something about a pink screen before.
Sorry ,
Same result: First: pink screen instead of camera, and, after loop, message Windows closing the job!
I could give the 32bit realese if you want to try on 32 bit
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: 32 to 64

Post by MrSwiss »

@opicard,

you've at least twice stated "Escapi Dll", which I assume to be 32bit, this then means:
the "Escapi Dll" would have to be converted and re-compiled to 64bit, before anything
else is looked at ... (if the source is still available).
or
a different library (64bit), with similar functionality, needs to be found, first ...
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: 32 to 64

Post by St_W »

MrSwiss wrote:you've at least twice stated "Escapi Dll", which I assume to be 32bit, this then means: [...]
The DLL is 64-bits, just have a look at the download. So none of the suggested actions are necessary. Note that a an 64-bit application wouldn't even compile when a 32-bit DLL is used (except when everything is loaded dynamically and no import libs are used).

@opicat: could you add the included "escapi.bi" file (and other non-standard include files required to compile, if there are any) on OneDrive? Additionally it would be nice if you could add a working 32-bit build or a 32-bit version of escapi.dll, so that the correct behavior of the application can be seen. I'll take a closer look on the code on thursday because I'm quite busy right now.
opicard
Posts: 81
Joined: Feb 26, 2008 16:40

Re: 32 to 64

Post by opicard »

St_W wrote:
MrSwiss wrote:you've at least twice stated "Escapi Dll", which I assume to be 32bit, this then means: [...]
The DLL is 64-bits, just have a look at the download. So none of the suggested actions are necessary. Note that a an 64-bit application wouldn't even compile when a 32-bit DLL is used (except when everything is loaded dynamically and no import libs are used).

@opicat: could you add the included "escapi.bi" file (and other non-standard include files required to compile, if there are any) on OneDrive? Additionally it would be nice if you could add a working 32-bit build or a 32-bit version of escapi.dll, so that the correct behavior of the application can be seen. I'll take a closer look on the code on thursday because I'm quite busy right now.
here you are (bis) : https://1drv.ms/f/s!AtIs3LBT5S-HdOTqpvs-TJvbYpE

launching ai0500 32b you should have a lovely screen produced by your camera... Perhaps escapi.dll is different on 64b?...
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: 32 to 64

Post by caseih »

opicard wrote:
caseih wrote:When you say, "same result" do you mean a crash? Please be specific. There are lots of definitions of "it doesn't work." You said something about a pink screen before.
Sorry ,
Same result: First: pink screen instead of camera, and, after loop, message Windows closing the job!
I could give the 32bit realese if you want to try on 32 bit
In other words it is crashing (segmentation fault). You'll need to get a debugger of some kind running (based on the Gnu debugger, not visual studio) and see if you can identify the point of crash and work backwards from there. I suspect two problems. First there's still a 32/64-bit problem in there when you try to get your image from the webcam dll. Second, the lack of data, or corrupted data resulting from the first problem is causing a crash in your FB code, probably an array bounds problem.

You are compiling your program with the -exx flag right? If not, do so immediately. That might turn a crash into an error message that will point to a bad array access.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: 32 to 64

Post by D.J.Peters »

I fixed and tested the 64-bit version with 3 cameras here are the download: AI_64b_fixed.zip

In escapi.bi (I wrote it many years ago for 32-bit) you have to replace all integer with long
and in the *bas file you have to replace CPtr(integer ptr,lpImage) with CPtr(ulong ptr,lpImage)

thats all :-)

Joshy
Last edited by D.J.Peters on Nov 13, 2017 20:12, edited 1 time in total.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: 32 to 64

Post by caseih »

Deleted.
Last edited by caseih on Nov 13, 2017 20:31, edited 2 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: 32 to 64

Post by D.J.Peters »

@caseih see at my last post.

Joshy
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: 32 to 64

Post by caseih »

I see. So the problem was in escapi.bi all along! Gotcha.

Yes the CPtr cast using Long Ptr is more correct, but that wouldn't actually matter other than compiler warnings, at least as far as his crash was concerned.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: 32 to 64

Post by D.J.Peters »

@caseih
on 32-bit pointer+=8 are 32 bytes (first pixel after the image header)
on 64-bit pointer+=8 are 64 bytes and must end in a corrupt memory.

Joshy
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: 32 to 64

Post by caseih »

Yes I know that. But the incorrect pointer arithmetic resulted from the wrong types in the .bi file. That was my point. The change made to his .bas file was just for the sake of correctness.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: 32 to 64

Post by MrSwiss »

@Joshy,

thanks for fixing the .bi/.dll for 64bit, great job (as always).

<off topic>
@St_W,
you've finally made it to my ignore-list. (I won't call you a foe because you lack the format for that.)
Your snotty, smart-ass comments, aren't worth reading, anyway.
</off topic>
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: 32 to 64

Post by BasicCoder2 »

Interesting project.
Your code worked ok on my old Windows 7 32bit machine. Unfortunately my recent windows 10 64bit machine keeps locking up my FreeBasic folders and files and I haven't been able to figure out why and how to fix it to test your code but it seems the solution to your problem has been found?
Regarding your code may I suggest for readability using elseif instead of an ever deepening indentation?
I changed your code (around line 61000) using elseif and it still worked.

Code: Select all

                ' ...
		If (ymo > 0 And ymo < 16 And xmo <= 884) Then  		' ligne 1	
                    nbpar = (xmo - 644)/24
		ElseIf (ymo > 16 And ymo < 32 And xmo <= 884) Then  	' ligne 2
                    nbpar = 10 + (xmo - 644)/24
                ElseIf (ymo > 32 And ymo < 48 And xmo <= 884) Then	' ligne 3  
                    nbpar = 20 + (xmo - 644)/24
                ElseIf (ymo > 48 And ymo < 64 And xmo <= 884) Then  	' ligne 4
                    nbpar = 30 + (xmo - 644)/24
                ElseIf (ymo > 64 And ymo < 80 And xmo <= 884) Then	' ligne 5
                    nbpar = 40 + (xmo - 644)/24
                ElseIf (ymo > 80 And ymo < 96 And xmo <= 884) Then	' ligne 6
                    nbpar = 50 + (xmo - 644)/24
                ElseIf (ymo > 96 And ymo < 112 And xmo <= 884) Then	' ligne 7  
                    nbpar = 60 + (xmo - 644)/24
                ElseIf (ymo > 112 And ymo < 128 And xmo <= 884) Then  	' ligne 8
                    nbpar = 70 + (xmo - 644)/24
                ElseIf (ymo > 128 And ymo < 144 And xmo <= 884) Then  	' ligne 9
                    nbpar = 80 + (xmo - 644)/24
                ElseIf (ymo > 0 And ymo < 16 And xmo > 884) Then  	' ligne 1
                    nbpar = 90 + (xmo - 884)/24
		ElseIf (ymo > 16 And ymo < 32 And xmo > 884) Then  	' ligne 2
                    nbpar = 92 + (xmo - 884)/24
		ElseIf (ymo > 32 And ymo < 48 And xmo > 884) Then  	' ligne 3
                    nbpar = 94 + (xmo - 884)/24
		ElseIf (ymo > 48 And ymo < 64 And xmo > 884) Then  	' ligne 4
                    nbpar = 96 + (xmo - 884)/24
		ElseIf (ymo > 64 And ymo < 80 And xmo > 884) Then  	' ligne 5
                    nbpar = 98 + (xmo - 884)/24
		ElseIf (ymo > 80 And ymo < 96 And xmo > 884) Then  	' ligne 6
                    nbpar = 100 + (xmo - 884)/24
		ElseIf (ymo > 96 And ymo < 112 And xmo > 884) Then  	' ligne 7
                    nbpar = 102 + (xmo - 884)/24
		ElseIf (ymo > 112 And ymo < 128 And xmo > 884) Then  	' ligne 8
                    nbpar = 104 + (xmo - 884)/24
		ElseIf (ymo > 128 And ymo < 144 And xmo > 884) Then  	' ligne 9
                    nbpar = 106 + (xmo - 884)/24
		ElseIf (ymo > 144 And ymo < 320 And xmo <= 884) And F06 Then
                    
                    '...  '     
                    
                End If
Last edited by BasicCoder2 on Nov 14, 2017 8:24, edited 1 time in total.
opicard
Posts: 81
Joined: Feb 26, 2008 16:40

Re: 32 to 64

Post by opicard »

BasicCoder2 wrote:Interesting project.
Your code worked ok on my old Windows 7 32bit machine. Unfortunately my recent windows 10 64bit machine keeps locking up my FreeBasic folders and files and I haven't been able to figure out why and how to fix it to test your code but it seems the solution to your problem has been found?
Regarding your code may I suggest for readability using elseif instead of ever an deepening indentation?
I changed your code (around line 61000) using elseif and it still worked.

Code: Select all

                ' ...
		If (ymo > 0 And ymo < 16 And xmo <= 884) Then  		' ligne 1	
                    nbpar = (xmo - 644)/24
		ElseIf (ymo > 16 And ymo < 32 And xmo <= 884) Then  	' ligne 2
                    nbpar = 10 + (xmo - 644)/24
                ElseIf (ymo > 32 And ymo < 48 And xmo <= 884) Then	' ligne 3  
                    nbpar = 20 + (xmo - 644)/24
                ElseIf (ymo > 48 And ymo < 64 And xmo <= 884) Then  	' ligne 4
                    nbpar = 30 + (xmo - 644)/24
                ElseIf (ymo > 64 And ymo < 80 And xmo <= 884) Then	' ligne 5
                    nbpar = 40 + (xmo - 644)/24
                ElseIf (ymo > 80 And ymo < 96 And xmo <= 884) Then	' ligne 6
                    nbpar = 50 + (xmo - 644)/24
                ElseIf (ymo > 96 And ymo < 112 And xmo <= 884) Then	' ligne 7  
                    nbpar = 60 + (xmo - 644)/24
                ElseIf (ymo > 112 And ymo < 128 And xmo <= 884) Then  	' ligne 8
                    nbpar = 70 + (xmo - 644)/24
                ElseIf (ymo > 128 And ymo < 144 And xmo <= 884) Then  	' ligne 9
                    nbpar = 80 + (xmo - 644)/24
                ElseIf (ymo > 0 And ymo < 16 And xmo > 884) Then  	' ligne 1
                    nbpar = 90 + (xmo - 884)/24
		ElseIf (ymo > 16 And ymo < 32 And xmo > 884) Then  	' ligne 2
                    nbpar = 92 + (xmo - 884)/24
		ElseIf (ymo > 32 And ymo < 48 And xmo > 884) Then  	' ligne 3
                    nbpar = 94 + (xmo - 884)/24
		ElseIf (ymo > 48 And ymo < 64 And xmo > 884) Then  	' ligne 4
                    nbpar = 96 + (xmo - 884)/24
		ElseIf (ymo > 64 And ymo < 80 And xmo > 884) Then  	' ligne 5
                    nbpar = 98 + (xmo - 884)/24
		ElseIf (ymo > 80 And ymo < 96 And xmo > 884) Then  	' ligne 6
                    nbpar = 100 + (xmo - 884)/24
		ElseIf (ymo > 96 And ymo < 112 And xmo > 884) Then  	' ligne 7
                    nbpar = 102 + (xmo - 884)/24
		ElseIf (ymo > 112 And ymo < 128 And xmo > 884) Then  	' ligne 8
                    nbpar = 104 + (xmo - 884)/24
		ElseIf (ymo > 128 And ymo < 144 And xmo > 884) Then  	' ligne 9
                    nbpar = 106 + (xmo - 884)/24
		ElseIf (ymo > 144 And ymo < 320 And xmo <= 884) And F06 Then
                    
                    '...  '     
                    
                End If
Thanks! i'll take that, it looks much better...
Post Reply