Sign in Join

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

Mailing lists / fpc-pascal / 2016-08

Does FPC supports the `delayed` directive?

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

silvioprog

Hello,

Firstly, a quot from Dr.Bob's site:

The basic idea of the solution is the fact that the DLL will not be loaded

right away (which is the case for implicit linking), but only when needed. So potentially “delayed”, and hence the name “delay loading”.

The main idea is the similar to the traditional dynamic loading library using LoadLibrary(), however, this directive ensures the compiler to handle it automatically for us.

Another quot:

The delayed directive is useful in the case where the imported routines do

Show quoted text 7 lines
not exist on the target operating system on which the application is run. Statically imported routines require that the operating system find and load the library when the application is started. If the routine is not found in the loaded library, or the library does not exist, the Operating System halts the execution of the application. Using the delayed directive enables you to check, at run time, whether the Operating System supports the required APIs; only then you can call the imported routines.

And the useful sources:

docwiki -
http://docwiki.embarcadero.com/CodeExamples/Berlin/en/DelayedLoading_(Delphi)

Dr.Bob - http://www.drbob42.com/examines/examinc1.htm

docwiki -
http://docwiki.embarcadero.com/RADStudio/Berlin/en/Libraries_and_Packages_(Delphi)

My test ({$mode delphi}; FPC from trunk):

  procedure foo(); cdecl; external 'foo' name 'foo' delayed;

The compiler error:

"Fatal: Syntax error, ";" expected but "identifier DELAYED" found".

Thank you!

Silvio Clécio

Reply by email

Sven Barth
to silvioprog
"silvioprog" wrote
On Sat, Aug 13, 2016 at 2:31 PM, Sven Barth
Show quoted text 14 lines
> > On 13.08.2016 18:38, silvioprog wrote: > > My test ({$mode delphi}; FPC from trunk): > > > > procedure foo(); cdecl; external 'foo' name 'foo' delayed; > > > > The compiler error: > > > > "Fatal: Syntax error, ";" expected but "identifier DELAYED" found". > > http://bugs.freepascal.org/view.php?id=23637 Great. Do you know if it was successfully accepted as a feature to be

implemented?

The feature itself will be implemented, though I can't tell you when.

Regards,
Sven

Reply by email