Sign in Join

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

Mailing lists / fpc-pascal / 2001-08

RE: DXE demo uploaded

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Aitor Santamaria Merino

(sorry as this topic became extinct some time ago, I am having troubles with my ISP and outgoing mail)

So now it seems I have started understanding the whole concept.

Show quoted text 15 lines
> > Some points about DXE: > > > > - The code loaded has to be totally self contained, and a unit. > Does this mean that: > (a) it can't be linked with other DXE's Only via the mainprogram (passing pointers around via the mainprogram) > (b) it can't be linked with ANY other code (i.e. no "USES") > ? Not yet. I'm still studying for a way to do this runtime, and for that I have to fully understand the COFF format. This won't happen overnight.

Ok! Keep up the good job and let us know!
It's a pitty that one can't design some UNITs that interface with the DXE, in order to "hide" so many pointers going here and there...

In addition, this will make the whole thing a lot easier, I suppose. Perhaps if this support is added, the RTL can then be used...

Show quoted text 16 lines
> > Nothing more. I'm studying on a system to enhance this at the > > moment. For the experimentors: Let this pointer point to a > > structure or function > > that can return more pointers to structures and functions. > > Via parameters to such functions, you can load global variables > > in the > > DXE with needed RTL functions. > > Two more related to this, about dxe_load, when I call it, the DXE is > loaded, then executed, then it disappears from memory? No. Unloading is not yet possible, but not hard to implement. In the future it can be removed from memory, but that will require an explicit call.

Can it be "exitted" using DOS interrupt for it? Is that what you mean by "explicit call"?
And if I run a program that calls DXEs, and the program dies, will the DXE die as well?

.DXE's also have the disadvantage that they need some memory to initialise(and relocate).

32 bit programs tend to eat few of the convenctional memory anyway...

A new one: Can I use DJGPP's DXE's from a FPK program, and conversely?

If only I knew more of the compiler internals, I would help you, but unfortunately, this is not the case, so I can only wish you a good session with that, Marco!

Thanks in advance,
Aitor

Marco van de Voort
to Aitor Santamaria Merino
(sorry as this topic became extinct some time ago, I am having troubles with my ISP and outgoing mail)

No problem at all.

Show quoted text 9 lines
> > (b) it can't be linked with ANY other code (i.e. no "USES") > > ? > > Not yet. I'm still studying for a way to do this runtime, and for > that I have > to fully understand the COFF format. This won't happen overnight. Ok! Keep up the good job and let us know! It's a pitty that one can't design some UNITs that interface with the DXE, in order to "hide" so many pointers going here and there...

One can try to wrap it.

In addition, this will make the whole thing a lot easier, I suppose. Perhaps if this support is added, the RTL can then be used...

That still doesn't solve calling from main to DXE, only the other way around.

Show quoted text 19 lines
> > > Nothing more. I'm studying on a system to enhance this at the > > > moment. For the experimentors: Let this pointer point to a > > > structure or function > > > that can return more pointers to structures and functions. > > > Via parameters to such functions, you can load global > variables > > > in the > > > DXE with needed RTL functions. > > > > Two more related to this, about dxe_load, when I call it, the > DXE is > > loaded, then executed, then it disappears from memory? > > No. Unloading is not yet possible, but not hard to implement. In > the future > it can be removed from memory, but that will require an explicit call. Can it be "exitted" using DOS interrupt for it? Is that what you mean by "explicit call"?

No. But you need to really do

Uses DXE;
var handle : dxehandle;
    thepointer : pointer;
begin
 handle:=loaddxe('my.dxe');
 ThePointer:=GetDXESymbol(Handle,0);  {Now always 0}
 [do your thing, cast thepointer to procedure type and call it]
 Unload(handle);
end.

The DXE unit (that supports unloading) is on

http://www.stack.nl/~marcov/dxe.pp

I also ported the dxegen util to Pascal. The source is in CVS in the fpc/utils/dxegen directory.

And if I run a program that calls DXEs, and the program dies, will the DXE die as well?

Then the DXE will be unloaded. The DXE is on the heap, and can be unloaded as long as there isn't a handler or so pointer into the DXE.

Hooking interrupts in DXE code is not smart :-)

Show quoted text 5 lines
> .DXE's also have the disadvantage that they need some memory to > initialise(and relocate). 32 bit programs tend to eat few of the convenctional memory anyway... A new one: Can I use DJGPP's DXE's from a FPK program, and conversely?

At the moment, yes, but watch your calling conventions, just like usual when interfacing with C.

In the future I'll have to stuff more info into the DXE, and it will become incompatible. But that "incompatible" stuff will be implementable in DJGPP too.

I'll change the magic if that happens, so that it won't cause accidents.

Pierre Muller
to Marco van de Voort
Then the DXE will be unloaded. The DXE is on the heap, and can be unloaded as long as there isn't a handler or so pointer into the DXE. Hooking interrupts in DXE code is not smart :-)

If I remember correctly, its not only not smart
but also impossible because of some test in the dpmiexcp.pp code if the address given outside normal text,
the signal handler do not work, but this only
applies to soft signals installed by signal function, not to true dpmi exception handlers.

Extracted from dpmiexcp.pp line 698 CVS revision 1.1.2.5

{ this is incompatible with dxegen-dxeload stuff PM } if ((cardinal(temp) < cardinal(@starttext)) or
(cardinal(temp) > cardinal(@endtext))) then

Aitor Santamaria Merino
The DXE unit (that supports unloading) is on http://www.stack.nl/~marcov/dxe.pp

Thanks, let's see if I can have some time to make tests...

Show quoted text 12 lines
> > .DXE's also have the disadvantage that they need some memory to > > initialise(and relocate). > 32 bit programs tend to eat few of the convenctional memory anyway... > > A new one: Can I use DJGPP's DXE's from a FPK program, and conversely? At the moment, yes, but watch your calling conventions, just like usual when interfacing with C. In the future I'll have to stuff more info into the DXE, and it will become incompatible. But that "incompatible" stuff will be implementable in DJGPP too.

Ok, for the moment I don't care, I am more interested in having something working properly for FreePascal. But it's interesting that this is also possible.

What I would like is to have at least a main program, which can load certain amount of DXEs, so that any of the DXEs (and the main program) can acceed to data stored by any other DXE (or main program), even if I need to design a whole engineery of pointers going here and there. And for the moment, it looks quite good.

The only serious (but not critical) obstacle that I see is the unability to USE other UNITs in one of these DLL, which will make my life somewhat more complicated and tedious. But I will be watching with patience to whichever changes and improvements are made. I would be grateful if you could announce any change in the list, Marco. For the moment, let's see if I get some spare time to download that unit, and I can make some tests. If you want to have some feedback (maybe in private) related to the DXE development, or any other possible collaboration, let me know.

Many thanks, and keep up the good job!

Aitor