Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-03

Software startup

3 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

Hello,

I am having some trouble with the symbian os port. Basically I am working with the emulator so far, so consider as if I were writing a normal (or almost) win32 application.

Basically windows will refuse running the application with a message saying it´s not a valid win32 application.

To test further, I created a trivial win32 asm app, assembled it with gas and linked it. Here is the file:

.file "prt0.as"
.text
/* Entry point for Symbian OS executables */
.globl E32EXE
E32EXE:
/* Entry point for MS Windows */
.globl main
main:
leave
ret

And here is how I assemble and link it:

C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\as.exe prt0.as -o prt0.o C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\ld.exe --entry=E32EXE -o prt0.exe prt0.o

This works fine (ok, the app doesn´t do anything, but also I don´t see any error messages). by the way, prt0 is just a random name ... don´t think it has anything to do with the prt0 asm files on fpc

Next I tryed to simply compile the same app, but adding the symbian RTL also:

C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\ld.exe --entry=E32EXE -o prt0.exe prt0.o C:\Programas\fpc21\rtl\units\i386-symbian\system.o qhelloworld.o

This won´t work. The executable is linked fine, but the app won´t run. I´m puzzled, because there is absolutely no reference from prt0.o to system.o or qhelloworld.o, so in fact, only prt0 should be used. Just by linking together the other .o files makes the .exe problematic.

Any ideas why? system.o is assembled with gnu asm too. I added qhelloworld.o only because linking system.o alone won´t work, as it complains about missing things.

And there are no main or E32EXE functions on either system.o or qhelloworld.o

This problem is important because it also occurs when I link a complete symbian app.

thanks,

Felipe Monteiro de Carvalho

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho

Ok, Florian found the solution! It´s a little complex, but I´ll write it here just in case someone is dying of curiosity or this helps some in the future =)

What happens is that when we build a software with fpc it will create it´s own executable description file (the link.res file that appears when we build with -s ), and when we use ld directly and don´t say anything about exe description, it will create a standard link.res file. And because the new smartlinking was activated for symbian, the default descriptor from ld would fail. This has something to do with the names of the sections. The default descriptor expects only .bss if I remember correctly and with smartlinking on it will create a .bss.something

We now deactivated smartlinking for symbian so things improved =)

PS: The port is going well, already managed to build the first pascal softwares for the emulator =) They do nothing more then creating a message box and quiting, but it´s a start.

Felipe Monteiro de Carvalho

Reply by email