Hi, All!
Using latest Lazarus/FPC (latest for 27.09.16) I'm unable to build a project, converted from Delphi using Lazarus converter.
After resolving various Delphi/Lazarus DCC/FPC incompatibility issues got stuck at linker's error:
xxxxx.dpr(77,1) Error: Undefined symbol: FindFirstFileExA;
FindFirstFileExA is exported by kernel32.dll, import stub for it is in ascdef.inc, (although missing 'kernel32.dll' name, but I added it and recompiled RTL, just in case):
function FindFirstFileEx(lpfilename : LPCStr;fInfoLevelId:FINDEX_INFO_LEVELS ;lpFindFileData:pointer;fSearchOp : FINDEX_SEARCH_OPS;lpSearchFilter:pointer;dwAdditionalFlags:dword):Handle; stdcall; external 'kernel32' name 'FindFirstFileExA';
There are two binary files (I'm not familiar with object file structure of FPC yet) having name of this func in them:
windows.ppu
libimpwindows.a
Main module has following uses:
Interfaces,
Windows,
LCLIntf, LCLType, LMessages,
Forms,
SysUtils
...
project own modules
...
I'm interested in how to resolve this error and this kind of errors in general - how some can figure out, what files are linked into, what file is referencing this identifier that is not found (if some can get actual error messages from linker).
Also, I'm wondering if it is possible to figure out what .pas moudle in RTL is including this particular .inc file. This is actually quite confusing, if some compares to Borland approach - when everything is in single .pas file. Here we have lot of includes. When I ask IDE to show me definition of it, it for sure shows me the .inc file, while I'm unaware, which module in particular includes it. How to figure it out? (Other way than doing grep search in RTL for $I <inc file name>)
Actually, stub project is not built as well:
program project1;
{$mode objfpc}{$H+}
uses
windows,
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
----------------------------------------------------------
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Interfaces,
Windows,
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;
type
TForm1 = class(TForm)
private
{ private declarations }
public
constructor Create;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
constructor TForm1.Create;
var
lHandle: THandle;
begin
lHandle := FindFirstFileEx('abc', FindExInfoStandard, nil, FindExSearchNameMatch, nil, 0);
end;
end.