Syntax rules for Lazarus Pascal procedural "Units" -


i organise app's source code pascal compilation units using file -> new unit

the following unit compiles ok ...

unit cryptounit;  {$mode objfpc}{$h+}  interface   function encrypt(key, plaintext:string):string;   function decrypt(key, ciphertext:string):string;  implementation  uses   classes, sysutils, blowfish;  function encrypt(key, plaintext:string):string;  ... 

however 1 has compilation errors can't identify "exception" @ line 6 ...

unit exceptionunit;  {$mode objfpc}{$h+}  interface   procedure dumpexceptioncallstack(e: exception);  // <--- problem  implementation  uses   classes, sysutils, fileutil;   { see http://wiki.freepascal.org/logging_exceptions }  procedure dumpexceptioncallstack(e: exception);       ... 

if assume exception defined in sysutils (how can tell?) can't put uses sysutils before interface (the compiler complains expecting interface)

how tell compiler exception defined in sysutils?

other units used used unit referenced after interface keyword, before other statements in interface section.

your example should work in following form:

unit exceptionunit;  {$mode objfpc}{$h+}  interface  uses   classes, sysutils, fileutil;  procedure dumpexceptioncallstack(e: exception);  implementation  { see http://wiki.freepascal.org/logging_exceptions }  procedure dumpexceptioncallstack(e: exception);  

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -