Forum > Operating Systems

problems loading file with crosscompiled code

<< < (2/3) > >>

MarkMLl:
We sympathise, but you'd make it far easier if you posted a complete program we could compile and test.

MarkMLl

dbannon:
CorBee, you say "crosscompile" ? Are you cross compiling or are you just taking your code to over to a windows box where you have another Lazarus install and compiling here ?

If the later, you should be able to narrow down the problem a bit, is it the MemoryImage.Loadfromfile(filename) thats going wrong ? Sure the copy of the image you have on the Windows box is not corrupted ?

Is it the same version of FPC/Lazarus ?  Have you read the docs for TFPMemoryImage  ? It might behave differenly on different platforms. I cannot find it but I guess you know where it is. If its a FP rtl function, you will not be able to step through it (without recompiling the RTL with debug info) but you can still read the code.

If you are really crosscompiling, then maybe its time you setup a Lazarus install on the Windows box (wash your hands carefully afterwards).

Davo

CorBee:
Hi Mark, Davo,

I was crosscompiling on Linux, so my linux machine was setup to crosscompile for windows. Ive taken the resulting exe to a windows machine and ... the problem I had (when testing it under wine or in a VM with Windows running from linux) was still present. I will setup the windows PC with lazarus and try if compiling from there results in a working exe file. If so, that seems to point more towards an issue with TFPMemoryImage due to crosscompiling. If the same problems exists still its an issue with TFPMemoryImage under windows. TFPMemoryImage is not a new part of freepascal/lazarus (ive used the same many years ago when I worked on this) but the documentation is rather minimalistic. But in my earlier usage I found this to be a rather easy way to get 16bit data from a png or tiff file that can be easily extracted. No need to write (or use) older code from the time I was programming with Delphi.

Thanks for responding, I will report back

Cor

CorBee:
Hi,

I have solved it ... in my original code I had several writeln commands that showed up nicely when developing in the Lazarus IDE. But those same writeln commands made the code fail under windows. I found out the hard way by just adding a simple Memo on the application and writing to that, suddenly I saw that it did load in to the memoryimage but it failed shortly after in another routine.

So after commenting them out ... the whole thing works as planned. So no problems with any of the code but just a major difference between Win64 and Linux in the way writeln is
working. I dont need writeln in this project so I will just use a logger to keep track during debugging.

If anybody knows why win64 fails because of this (using a crosscompiler from Linux) I would like to hear that. Thanks
for the help !

cheers
Cor

dbannon:
Yeah, Lazarus apps normally don't have a console, writeln writes to the console.  There is some way to declare a lazarus app as having a console but I cannot remember ...

Better to use debugln(), it writes to the console on Linux and its output can be captured to a file on windows. Sadly, you need to remove all writeln() in your code, except, of course ones writing to a file.

Good that you have solved the bigger problem !

Davo

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version