[fpc-pascal] Does FPC supports the `delayed` directive?

silvioprog silvioprog at gmail.com
Sat Aug 13 18:38:54 CEST 2016


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
> 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 -

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

docwiki -

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160813/74ae457c/attachment.html>

More information about the fpc-pascal mailing list