Sign in Join

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

Mailing lists / fpc-pascal / 2001-07

GO32V2 EXE architecture...

11 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Kanzelsberger Pavel

Hi,

I'm planning to develop something like DLL support for GO32V2 platform and I can't any decent documentation of these EXE files, can someone point me to website where can I find their structure and some additional information?

Anyway what has to be done to load EXE and find entry point? I know that I have to rellocate memory addresses and so on...

As far I remember there was something like this for TMT pascal, if someone already played with it and/or ported it to FPC please let me know :)

Thanks, Pavel Kanzelsberger

Earlier message 27 lines
-----Original Message----- From: jordi Sent: Monday, July 16, 2001 6:03 PM To: Free Pascal Subject: [fpc-pascal]executing different gtk applications from FPC Please, can someone help me? In a Free Pascal program and using GTK, I do the next when push a help button : exec ('/usr/bin/gnome-help-browser', 'man:manual_page'); but the program freezes until I close the help. The question is : how can I execute different gtk applications from Free Pascal in a absolute independant way?. Perhaps with FORK and WAITPID but I don't know how. Thanks. -- Salutacions. Jordi. http://perso.wanadoo.es/jovy
Marco van de Voort
to Kanzelsberger Pavel
I'm planning to develop something like DLL support for GO32V2 platform and I can't any decent documentation of these EXE files, can someone point me to website where can I find their structure and some additional information?

Check the DJGPP site(s). Specially look for DXE support, which should already exist.

Kanzelsberger Pavel

OK, thanks...

Regards, Pavel Kanzelsberger

Earlier message 16 lines
-----Original Message----- From: Sent: Tuesday, July 17, 2001 9:46 AM To: Subject: Re: [fpc-pascal]GO32V2 EXE architecture... > I'm planning to develop something like DLL support for GO32V2 platform > and I can't any decent documentation of these EXE files, can someone > point me to website where can I find their structure and some > additional information? Check the DJGPP site(s). Specially look for DXE support, which should already exist.
Kanzelsberger Pavel

I was checking FPC sources also and found DXE loader in RTL, DXE format is quite easy but it differs from EXE file, is there any way to compile DXE file with FPC or I have to write some kind of EXEtoDXE converter?

Regards, Pavel Kanzelsberger

Earlier message 16 lines
-----Original Message----- From: Sent: Tuesday, July 17, 2001 9:46 AM To: Subject: Re: [fpc-pascal]GO32V2 EXE architecture... > I'm planning to develop something like DLL support for GO32V2 platform > and I can't any decent documentation of these EXE files, can someone > point me to website where can I find their structure and some > additional information? Check the DJGPP site(s). Specially look for DXE support, which should already exist.
Kanzelsberger Pavel

Sorry for last e-mail, I found DXEGEN utility that generates .DXE file and can export one symbol from *.o file, anyway to work properly I have to get all DJGPP utils...

thanks again, Pavel Kanzelsberger

Earlier message 30 lines
-----Original Message----- From: Kanzelsberger Pavel Sent: Tuesday, July 17, 2001 11:14 AM To: '' Subject: RE: [fpc-pascal]GO32V2 EXE architecture... I was checking FPC sources also and found DXE loader in RTL, DXE format is quite easy but it differs from EXE file, is there any way to compile DXE file with FPC or I have to write some kind of EXEtoDXE converter? Regards, Pavel Kanzelsberger -----Original Message----- From: ] Sent: Tuesday, July 17, 2001 9:46 AM To: Subject: Re: [fpc-pascal]GO32V2 EXE architecture... > I'm planning to develop something like DLL support for GO32V2 platform > and I can't any decent documentation of these EXE files, can someone > point me to website where can I find their structure and some > additional information? Check the DJGPP site(s). Specially look for DXE support, which should already exist.
Kanzelsberger Pavel

Well seems that i'll keep mailing here :-))

I tried DXEGEN and it fails due to unrecognized symbols (which are FPC specific) in .o file...
Is there any way how to remove them without editing .sw file?

C:\DJGPP>dxegen lib.dxe _ADD lib.o
ld -X -S -r -o dxe__tmp.o -Lc:/djgpp/lib lib.o -T dxe.ld Error: object contains unresolved external symbols (FPC_STACKCHECK) Error: object contains unresolved external symbols (INIT$$SYSTEM) Error: object contains unresolved external symbols (FPC_INITIALIZEUNITS) Error: object contains unresolved external symbols (FPC_DO_EXIT)

lib.pas
-----------------
funciont add (a,b:longint):longint;
 begin
 add:=a+b;
 end;
begin
end.
----------------
Earlier message 43 lines
-----Original Message----- From: Kanzelsberger Pavel Sent: Tuesday, July 17, 2001 11:29 AM To: '' Subject: RE: [fpc-pascal]GO32V2 EXE architecture... Sorry for last e-mail, I found DXEGEN utility that generates .DXE file and can export one symbol from *.o file, anyway to work properly I have to get all DJGPP utils... thanks again, Pavel Kanzelsberger -----Original Message----- From: Kanzelsberger Pavel Sent: Tuesday, July 17, 2001 11:14 AM To: '' Subject: RE: [fpc-pascal]GO32V2 EXE architecture... I was checking FPC sources also and found DXE loader in RTL, DXE format is quite easy but it differs from EXE file, is there any way to compile DXE file with FPC or I have to write some kind of EXEtoDXE converter? Regards, Pavel Kanzelsberger -----Original Message----- From: ] Sent: Tuesday, July 17, 2001 9:46 AM To: Subject: Re: [fpc-pascal]GO32V2 EXE architecture... > I'm planning to develop something like DLL support for GO32V2 platform > and I can't any decent documentation of these EXE files, can someone > point me to website where can I find their structure and some > additional information? Check the DJGPP site(s). Specially look for DXE support, which should already exist.
Marco van de Voort
to Kanzelsberger Pavel
Show quoted text 12 lines
Well seems that i'll keep mailing here :-)) I tried DXEGEN and it fails due to unrecognized symbols (which are FPC specific) in .o file... Is there any way how to remove them without editing .sw file? C:\DJGPP>dxegen lib.dxe _ADD lib.o ld -X -S -r -o dxe__tmp.o -Lc:/djgpp/lib lib.o -T dxe.ld Error: object contains unresolved external symbols (FPC_STACKCHECK) Error: object contains unresolved external symbols (INIT$$SYSTEM) Error: object contains unresolved external symbols (FPC_INITIALIZEUNITS) Error: object contains unresolved external symbols (FPC_DO_EXIT)

I think you could simply try to create an empty assembler file that defines those symbols for that, assemble

Something like

.file "dummydxe.as"

.text
.balign 16
.globl FPC_STACKCHECK :
ret
.balign 16

.globl INIT$$SYSTEM :
ret
.balign 16
.globl FPC_INITIALIZEUNITS :
ret
.balign 16
.globl FPC_DO_EXIT:
ret

Kanzelsberger Pavel

Oh, that's not what I mean exactly...

That DXEGEN cannot convert .o file to .dxe because it doesn't understands these symbols, I want to find way how to remove them (or do anything else) so DXEGEN can successfully convert .o file...

Regards, Pavel Kanzelsberger

Earlier message 45 lines
-----Original Message----- From: Sent: Tuesday, July 17, 2001 12:30 PM To: Subject: Re: [fpc-pascal]GO32V2 EXE architecture... > Well seems that i'll keep mailing here :-)) > > I tried DXEGEN and it fails due to unrecognized symbols (which are FPC > specific) in .o file... > Is there any way how to remove them without editing .sw file? > > C:\DJGPP>dxegen lib.dxe _ADD lib.o > ld -X -S -r -o dxe__tmp.o -Lc:/djgpp/lib lib.o -T dxe.ld > Error: object contains unresolved external symbols (FPC_STACKCHECK) > Error: object contains unresolved external symbols (INIT$$SYSTEM) > Error: object contains unresolved external symbols > (FPC_INITIALIZEUNITS) > Error: object contains unresolved external symbols (FPC_DO_EXIT) I think you could simply try to create an empty assembler file that defines those symbols for that, assemble Something like .file "dummydxe.as" .text .balign 16 .globl FPC_STACKCHECK : ret .balign 16 .globl INIT$$SYSTEM : ret .balign 16 .globl FPC_INITIALIZEUNITS : ret .balign 16 .globl FPC_DO_EXIT: ret
Marco van de Voort
to Kanzelsberger Pavel
Show quoted text 5 lines
Oh, that's not what I mean exactly... That DXEGEN cannot convert .o file to .dxe because it doesn't understands these symbols, I want to find way how to remove them (or do anything else) so DXEGEN can successfully convert .o file...

I mean do a

as bla.s -o bla.o

or so

And then add bla.o to the DXEGEN commandline. The symbols are added but empty/directly return.

Their functionality is reasonably unneeded, at least for this initial testing. (deal with unit initialisation)

Also note that you might get into problems with namemangling.

Define the entry procedure with

function add(a,b:longint):longint; external '_add'

and then use _add for "symbol" on the dxegen line below.

So something like

DXEGEN add.dxe _add add.o bla.o

(
DXE allows you to dynamically load code and data from a file and execute it. Limitations: you cannot do I/O (and some other functions) directly from a DXE loaded image. There is a single entry point (subroutine or data block returned).

There are two parts to DXE - the generator and the loader.

The DXE generator is a program with the usage:

C:\> dxegen output.dxe symbol input.o [input2.o ... -lgcc -lc]

output.dxe is the name you want to contain your dynamic load code. symbol is the procedure name (or data structure) you want a pointer to, remember to add the initial underscore for most symbols. The input.o is created with GCC from your source. Additional arguments on the command line (.o and .a files; or other ld options) are passed to ld to resolve references to build your code.

The loader only adds around 300 bytes to your image, and the prototype is found in <sys/dxe.h>:

  void *_dxe_load(char *filename);

It takes a single argument which is the file on disk containing the dynamic execution code. It returns a pointer to the symbol you specified at DXE generation time. See the documentation of dxe_load' in the library docs, for more details ("info libc alpha _dxe_load" from the DOS prompt). )

Kanzelsberger Pavel

Ah okies! Going to give it a try, I will inform you :)

Earlier message 68 lines
-----Original Message----- From: Sent: Tuesday, July 17, 2001 1:14 PM To: Subject: Re: [fpc-pascal]GO32V2 EXE architecture... > Oh, that's not what I mean exactly... > > That DXEGEN cannot convert .o file to .dxe because it doesn't > understands these symbols, I want to find way how to remove them (or > do anything else) so DXEGEN can successfully convert .o file... I mean do a as bla.s -o bla.o or so And then add bla.o to the DXEGEN commandline. The symbols are added but empty/directly return. Their functionality is reasonably unneeded, at least for this initial testing. (deal with unit initialisation) Also note that you might get into problems with namemangling. Define the entry procedure with function add(a,b:longint):longint; external '_add' and then use _add for "symbol" on the dxegen line below. So something like DXEGEN add.dxe _add add.o bla.o ( DXE allows you to dynamically load code and data from a file and execute it. Limitations: you cannot do I/O (and some other functions) directly from a DXE loaded image. There is a single entry point (subroutine or data block returned). There are two parts to DXE - the generator and the loader. The DXE generator is a program with the usage: C:\> dxegen output.dxe symbol input.o [input2.o ... -lgcc -lc] output.dxe is the name you want to contain your dynamic load code. symbol is the procedure name (or data structure) you want a pointer to, remember to add the initial underscore for most symbols. The input.o is created with GCC from your source. Additional arguments on the command line (.o and .a files; or other ld options) are passed to ld to resolve references to build your code. The loader only adds around 300 bytes to your image, and the prototype is found in <sys/dxe.h>: void *_dxe_load(char *filename); It takes a single argument which is the file on disk containing the dynamic execution code. It returns a pointer to the symbol you specified at DXE generation time. See the documentation of dxe_load' in the library docs, for more details ("info libc alpha _dxe_load" from the DOS prompt). )