Sign in Join

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

Mailing lists / lazarus / 2012-06

Shared library names

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Mark Morgan Lloyd

When building a shared library (.dll or .so), is it possible to append a timestamp? i.e. something like backend_$(IsoDate)_$(IsoTime).so for a result like backend_2012-06-05_09:59:30.so

What I'm trying to do is have a frontend that holds (e.g.) a database transaction open, with a backend that can be reloaded on-the-fly without interrupting work. However I don't want to have to close/release the library while its replacement is moved into position, simply to send the frontend e.g. a HUP signal at which point it loads the most recent available (or reverts to one known to be bug-free).

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to leledumbo
leledumbo wrote
Just use the -o option, but I'm not really sure about the date and time

I think the date/time could probably be appended to a shared library after it had been built, i.e. Project -> Compilation -> Execute after. However doing this would rely heavily on sh and backticks, so there could be portability issues.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Marco van de Voort
to Mark Morgan Lloyd: When building a shared library (.dll or .so), is it possible to append a timestamp? i.e.…
Mark Morgan Lloyd wrote
When building a shared library (.dll or .so), is it possible to append a timestamp? i.e. something like backend_$(IsoDate)_$(IsoTime).so for a result like backend_2012-06-05_09:59:30.so

I did a few quick tests with $libsuffix, but can't seem to use constants or other dates:

library libtest;
const mydate = '{$i %date%}';
const mydate2 = {$i %date%};
{$libsuffix mydate}
{$libsuffix mydate2}
{$libsuffix {$i %date%}}
begin
end.

Since afaik some preprocessor directive now expand constants (since Delphi does), it might be worth a bugreport.

Reply by email

Mark Morgan Lloyd
to Marco van de Voort
Marco van de Voort wrote 21 lines
On Tue, Jun 05, 2012 at 10:02:52AM +0000, Mark Morgan Lloyd wrote: > When building a shared library (.dll or .so), is it possible to append a > timestamp? i.e. something like backend_$(IsoDate)_$(IsoTime).so for a > result like backend_2012-06-05_09:59:30.so I did a few quick tests with $libsuffix, but can't seem to use constants or other dates: library libtest; const mydate = '{$i %date%}'; const mydate2 = {$i %date%}; {$libsuffix mydate} {$libsuffix mydate2} {$libsuffix {$i %date%}} begin end. Since afaik some preprocessor directive now expand constants (since Delphi does), it might be worth a bugreport.

OK, but before I do that I wonder if somebody could clarify where Lazarus should leave a .so when it is successfully built. What appears to be happening at the moment (1.1 r37496) is that it leaves it in what the project options refer to as the "Unit output directory" and while it obeys "Apply conventions" it ignores the "Target file name" setting.

I'm currently using an "Execute after" command to move it to its final location and append a timestamp, the timestamp is ISO-format so that it sorts properly which gives the same behavious as ldconfig (i.e. when there's a choice the most recent library is the one used).

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email