[fpc-devel] Re: Exporting from Elf okay?
L505
fpc505 at z505.com
Sun Aug 7 06:18:13 CEST 2005
[moved to devel]
|
| With regards to gnu linux:
| How about the Elf format?
| Is it possible to export code from an elf? (i.e. export functions)
|
Okay, I researched the topic. Of course, yes, you can export functions from an executable
on linux. But freepascal doesn't seem to like it just yet. It must be done supposedly
with the -E option to the linker (ld) or -export-dynamic
(gcc is -rdynamic)
This of course, was after modifying the compiler to parse the
exports keyword properly
[psub.pas]
else if islibrary or
(target_info.system in [system_i386_linux,system {<<<inserted this}<SNIP>]) then
read_exports
So after getting the parsing of the exports keyword set up to work, I tried passing the -E
option in freepascal compiler (the -k option as also seen in the lazarus linker options
tab)
After compiling a program, with an export it didn't seem to work properly. It compiles
okay, but when I run it two writeln('test')'s appear instead of one, and the program quits
without an error.
So now the next thing to figure out, is why exports from an executable on linux won't
work
even when you pass the -E or export-dynamic option to LD.
I'm guessing the symbols aren't being placed in the object files correctly for the linker
to use, or they aren't being placed there at all. If you guys have any tips let me know..
I'll be looking into the compiler sources more, probably the sections that write the
object files now.
More information about the fpc-devel
mailing list