Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-04 Thread Graeme Geldenhuys
On 2013-06-03 17:32, Ewald wrote: Well, you can obviously use tool bin2obj created with/for FPC and distributed with FPC releases - see fpcsrc/utils/bin2obj.pp. Seriously? I should really start looking at included tools... I've got this feeling that it will save me some time. That's how

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-04 Thread Rainer Stratmann
On Monday 03 June 2013 23:49:07 you wrote: Jonas, It's not happening. I have a 700kb image base64 encoded in a file called orangesky.res. I never use procedure TestResource; and yet the exe is 700kb larger. The only way to get rid of that extra 700k is to delete the procedure. The smart

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-04 Thread Rainer Stratmann
On Tuesday 04 June 2013 12:16:24 you wrote: On Monday 03 June 2013 23:49:07 you wrote: Jonas, It's not happening. I have a 700kb image base64 encoded in a file called orangesky.res. I never use procedure TestResource; and yet the exe is 700kb larger. The only way to get rid of that

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-04 Thread Anthony Walter
I came with a nice solution to all this and thought I'd share... I wrote a tool named makeres. In Lazarus edit the default project configuration adding Compilation | Execute Before | makeres $(CompPath). Then when ever you build/run a project the following happens: * Two directories are created

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-04 Thread luiz americo pereira camara
2013/6/4 Anthony Walter sys...@gmail.com: I came with a nice solution to all this and thought I'd share... I wrote a tool named makeres. Is it open source? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-04 Thread Anthony Walter
Yes, it will be. I am working on releasing the next version of my open source game library which. It includes many new features including static linking (no external dependencies, lib sdl2 rc1, lib tesselation, lib openssl on windows, full opengles support, android support is getting closer) which

[fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Anthony Walter
I am trying to come up with an embedded binary resource system and was considering placing data in object files when I found this question on stack overflow: http://stackoverflow.com/questions/4158900/embedding-resources-in-exe-using-gcc I see that it's possible to directly turn any file into an

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Ewald
Once upon a time, Tomas Hajny said: On Mon, June 3, 2013 18:09, Ewald wrote: Well, you can obviously use tool bin2obj created with/for FPC and distributed with FPC releases - see fpcsrc/utils/bin2obj.pp. Seriously? I should really start looking at included tools... I've got this feeling that it

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Rainer Stratmann
On Monday 03 June 2013 17:47:46 you wrote: I am trying to come up with an embedded binary resource system and was considering placing data in object files when I found this question on stack overflow: http://stackoverflow.com/questions/4158900/embedding-resources-in-exe-using -gcc I see

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Rainer Stratmann
On Monday 03 June 2013 17:47:46 you wrote: I am trying to come up with an embedded binary resource system and was considering placing data in object files when I found this question on stack overflow: http://stackoverflow.com/questions/4158900/embedding-resources-in-exe-using -gcc I see

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Ewald
Once upon a time, Anthony Walter said: I am trying to come up with an embedded binary resource system and was considering placing data in object files when I found this question on stack overflow: http://stackoverflow.com/questions/4158900/embedding-resources-in-exe-using-gcc I see that

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Anthony Walter
Wow, thanks for all the interesting replies. In the mean time here is what I came up with: ld -r -b binary -o binary.o helloworld.txt #include stdint.h extern char _binary_helloworld_txt_start[]; extern char _binary_helloworld_txt_end[]; void* helloworld(uintptr_t* i) { uintptr_t a =

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Rainer Stratmann
For me this seems (too) complicated to do an easy thing (including some data). On Monday 03 June 2013 18:51:59 you wrote: Wow, thanks for all the interesting replies. In the mean time here is what I came up with: ld -r -b binary -o binary.o helloworld.txt #include stdint.h extern

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Ewald
Once upon a time, Rainer Stratmann said: For me this seems (too) complicated to do an easy thing (including some data). That, and I don't think that ld on mac os x can handle `-b` (or --format). -- Ewald ___ fpc-pascal maillist -

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Anthony Walter
I think I'll use Rainer's example: {$ir file.dat mydata} I just hope the final exe won't get bloated if resource are included in this manner and never used and also that it does slow down compilation every time unless I add to new resources or change code in the unit containing the resource.

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Rainer Stratmann
On Monday 03 June 2013 20:01:45 you wrote: I think I'll use Rainer's example: {$ir file.dat mydata} You can try, but I am not aware that this will work. It was a suggestion. :-) I just hope the final exe won't get bloated if resource are included in this manner and never used and also

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Anthony Walter
Okay I found some interesting results after a bit of testing... When using bin2obj you get a byte of array typed constant which you can include in your sources. The compiler will always include the resource whether it is referenced from code or not. Stripping the app (strip -s -g appname) does

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Jonas Maebe
On 03 Jun 2013, at 22:22, Anthony Walter wrote: What this means is that all string constants and typed constants are take up space in your executable whether your use them or not, which is not ideal IMO. The compiler ought to be able to detect when these constants are not referenced (much

Re: [fpc-pascal] Placing binary data (resources) in object files?

2013-06-03 Thread Anthony Walter
Nevermind, Jonas you're right. I was missing the -C ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal