32 to 64
32 to 64
Hi,
What precautions to move from 32 to 64 bits with Freebasic?
In truth my code under 32 bits no longer works under 64 bits, and I have yet well used Fb 64b compiler ...
It seems to be a memory pointer problem ...
Thanks in advance
What precautions to move from 32 to 64 bits with Freebasic?
In truth my code under 32 bits no longer works under 64 bits, and I have yet well used Fb 64b compiler ...
It seems to be a memory pointer problem ...
Thanks in advance
Re: 32 to 64
Size of Integers and Pointers is 32 bits in 32-bit mode and 64 bits in 64-bit mode.
More details about non-functioning in 64-bit would be welcome.
Sometimes a real bug (such as accessing out of its allocated memory) can even be inconsequential in 32-bit and cause a crash in 64-bit (depending on memory mapping).
Does your program work in 32-bit, compiled with gas and also compiled with gcc?
More details about non-functioning in 64-bit would be welcome.
Sometimes a real bug (such as accessing out of its allocated memory) can even be inconsequential in 32-bit and cause a crash in 64-bit (depending on memory mapping).
Does your program work in 32-bit, compiled with gas and also compiled with gcc?
Re: 32 to 64
The most common fault is the use if (U)INTEGER instead of LONG or INTEGER<32> in places where a 32-bit integer is required. Note that INTEGER is 32-bits on 32-bit systems and 64-bits on 64-bit systems.
Other problems can occur when pointer arithmetic is used wrongly (e.g. with constants instead of SIZEOF(...) or using the wrong pointer data type).
Other problems can occur when pointer arithmetic is used wrongly (e.g. with constants instead of SIZEOF(...) or using the wrong pointer data type).
Re: 32 to 64
fxm wrote:Size of Integers and Pointers is 32 bits in 32-bit mode and 64 bits in 64-bit mode.
More details about non-functioning in 64-bit would be welcome.
Sometimes a real bug (such as accessing out of its allocated memory) can even be inconsequential in 32-bit and cause a crash in 64-bit (depending on memory mapping).
Does your program work in 32-bit, compiled with gas and also compiled with gcc?
see http://france3-regions.francetvinfo.fr/ ... 86541.html
It works successfully sicne 5 years, but i never compiled it with gas or gcc...
the job is supposed to access a camera image with the help of the Escapi Dll, or to access a .bmp file using the Bload instruction.
Instead of the camera image, or the image file, the program displays a pink screen ... then after about a second of loop, a windows error appears and closes the program
Re: 32 to 64
Ok thanks, but it works very successfully since 5 years without any error on a 32 bit windos system... see https://www.youtube.com/user/PicolclavSt_W wrote:The most common fault is the use if (U)INTEGER instead of LONG or INTEGER<32> in places where a 32-bit integer is required. Note that INTEGER is 32-bits on 32-bit systems and 64-bits on 64-bit systems.
Other problems can occur when pointer arithmetic is used wrongly (e.g. with constants instead of SIZEOF(...) or using the wrong pointer data type).
the job is supposed to access a camera image with the help of the Escapi Dll, or to access a .bmp file using the Bload instruction.
Instead of the camera image, or the image file, the program displays a pink screen ... then after about a second of loop, a windows error appears and closes the program
Re: 32 to 64
Of course, as INTEGER and LONG are practically the same in the 32-bit version of the compiler. As soon as you use the 64-bit compiler that's not the case anymore as INTEGER is a 64-bit number then.opicard wrote:Ok thanks, but it works very successfully since 5 years without any error on a 32 bit windos system... see https://www.youtube.com/user/Picolclav
If you're using an external DLL you need it as 64-bit version for the 64-bit build, but I guess you're already doing that correctly as it probably wouldn't even compile otherwise.opicard wrote:the job is supposed to access a camera image with the help of the Escapi Dll, or to access a .bmp file using the Bload instruction.
Instead of the camera image, or the image file, the program displays a pink screen ... then after about a second of loop, a windows error appears and closes the program
As the INTEGER/LONG issue is so common I'm quite sure that this is also the problem in your code. Especially take a look at the code locations handling with pointers and binary file I/O. If you want us to help you'd need to share (at least parts of) your code, if that is an option.
-
- Posts: 3954
- Joined: Jan 01, 2009 7:03
- Location: Australia
Re: 32 to 64
Really? That is a FreeBASIC program using a webcam?opicard wrote:Ok thanks, but it works very successfully since 5 years without any error on a 32 bit windows system... see https://www.youtube.com/user/Picolclav
My usb webcam images were too slow and I had to rely on the laptop's inbuilt camera for fastest responses.
Although I could translate the text of the page I was unable to follow the utube speech as I am limited to the English language.
I think there are visual systems that warn drivers if they stray over a white line. Most of our major highways also have little bumps that cause a vibrating sound should you wander over the line.
.
Re: 32 to 64
OK to share, but 22 000 lines too big! is there some other way to send you the code?St_W wrote:[
As the INTEGER/LONG issue is so common I'm quite sure that this is also the problem in your code. Especially take a look at the code locations handling with pointers and binary file I/O. If you want us to help you'd need to share (at least parts of) your code, if that is an option.
Re: 32 to 64
Yes it does drive my car since 5 years. I do not have to hold the steering wheel when the white lines are clearly visible by the camera, and if not, an alert prompts me to take over the steering wheel.BasicCoder2 wrote:Really? That is a FreeBASIC program using a webcam?opicard wrote:Ok thanks, but it works very successfully since 5 years without any error on a 32 bit windows system... see https://www.youtube.com/user/Picolclav
My usb webcam images were too slow and I had to rely on the laptop's inbuilt camera for fastest responses.
Although I could translate the text of the page I was unable to follow the utube speech as I am limited to the English language.
I think there are visual systems that warn drivers if they stray over a white line. Most of our major highways also have little bumps that cause a vibrating sound should you wander over the line.
.
But it doesn't on 64 bits...
Re: 32 to 64
Wow, that's really a lot of code and probably makes finding the issue quite time consuming. I can't promise that I or other forum members will be able to find the issue(s) in a reasonable amount of time we'd like to invest. Anyway, I'll try my best . To share your file(s) you have to use some external file sharing service and share the link here on the forums. Examples for common sites with registration: Dropbox, Mediafire, OneDrive, Google Drive; without registration: file-upload.net , ... and a lot more; feel free to choose any (but please avoid sites requiring a paid account to download without hassles like e.g. uploaded.net).opicard wrote:OK to share, but 22 000 lines too big! is there some other way to send you the code?
Re: 32 to 64
You can also use GitHub. It's not only for source code, you can put anything in the repository if you wish (all the data that you program needs to run, for example, images, dlls and the like)opicard wrote:OK to share, but 22 000 lines too big! is there some other way to send you the code?
Re: 32 to 64
St_W wrote:Wow, that's really a lot of code and probably makes finding the issue quite time consuming. I can't promise that I or other forum members will be able to find the issue(s) in a reasonable amount of time we'd like to invest. Anyway, I'll try my best . To share your file(s) you have to use some external file sharing service and share the link here on the forums. Examples for common sites with registration: Dropbox, Mediafire, OneDrive, Google Drive; without registration: file-upload.net , ... and a lot more; feel free to choose any (but please avoid sites requiring a paid account to download without hassles like e.g. uploaded.net).opicard wrote:OK to share, but 22 000 lines too big! is there some other way to send you the code?
here you are (on one drive) : https://1drv.ms/f/s!AtIs3LBT5S-HdOTqpvs-TJvbYpE
The folder contains the. BAS, the .exe, and the mini environment to work.
You need a 64 bit PC with a camera.
By launching the program, you should get the camera image on the screen, not a pink screen ...
I lightened the code for you ...
-
- Posts: 862
- Joined: May 05, 2015 5:35
- Location: Germany
Re: 32 to 64
Only a suggestion: Replace all Integer keywords with Long (using find & replace of your IDE) and all UInteger with ULong and see if it works. I can't test it, I'm still on 32bit.
Re: 32 to 64
Thanks but... same result...grindstone wrote:Only a suggestion: Replace all Integer keywords with Long (using find & replace of your IDE) and all UInteger with ULong and see if it works. I can't test it, I'm still on 32bit.
Re: 32 to 64
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.
I'm afraid there's no shortcut to debugging. You'll have to do the normal process of isolating the code where the problem most likely is occurring, and examining the values your data structures are holding vs the working 32-bit version.
I'm afraid there's no shortcut to debugging. You'll have to do the normal process of isolating the code where the problem most likely is occurring, and examining the values your data structures are holding vs the working 32-bit version.