I've got a shared library (.so) I wrote in C, with initialization and finalization code declared by using the GCC attributes constructor and destructor. These init and fini functions simply print out "start" and "stop" to stdout. The .so exports one function, which prints out "Hello".
I've got a test program (also written in C) which calls the .so's function. What I see on stdout is start Hello stop Just like you'd expect. I wrote a Free Pascal test program which also uses the .so. However, what I see is this: start Hello So for some reason, the fini never seems to get called! I thought this was strange, so I wrote a similar library in free pascal: ============================================== library subs; procedure SayHello (); cdecl; export; begin writeln('Hello '); end; exports SayHello; initialization writeln('start'); finalization writeln('done'); end. ============================================== Again, I ran a c test program against it and a fpc test program against it. The C program's output was: start Hello stop The freepascal program's output was: Hello What's going on here? With humble thanks, Seth Grover -- Seth Grover sethdgrover[at]gmail[dot]com http://grovers.us/seth Who is John Galt? _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal