Skip to content

Could not generate DEF file for library

fpc -help says

-D     Generate a DEF file

I have a CalcLib.pas

library calc;

function Add(a: integer; b: integer): integer; cdecl;
begin
  Add := a + b;
end;

exports
  Add;

end.

I run

> fpc -D CalcLib.pas
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling CalcLib.pas
Linking CalcLib.dll
12 lines compiled, 0.1 sec, 28608 bytes code, 1316 bytes data

But there is no DEF file

> dir


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           10/5/2024  5:28 PM          37376 CalcLib.dll
-a---           10/5/2024  5:28 PM           2911 CalcLib.o
-a---           10/5/2024  5:21 PM            159 CalcLib.pas
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information