I've removed Interfaces and that just caused the original error.
I was using the pas2html demo as a guide for using this component in a command line app. I have now written that app which again is working in Windows (with the Interfaces unit) but not in Linux with or without Interfaces.
The new app looks like this:
program highlight;
{$mode objfpc}{$H+}
uses
Classes, SysUtils, SynExportHTML, SynHighlighterHTML, SynHighlighterPas,
SynHighlighterAny, SynHighlighterPHP, SynHighlighterSQL, SynHighlighterXML,
SynHighlighterCSS, miscfunc;
var
exporter: TSynExporterHTML;
CSS: TSynCSSSyn;
HTML: TSynHTMLSyn;
Pas: TSynPasSyn;
PHP: TSynPHPSyn;
Misc: TSynAnySyn;
SQL: TSynSQLSyn;
XML: TSynXMLSyn;
fc: TStrings;
output: TStrings;
Data: TMemoryStream;
begin
if ParamCount = 0 then
begin
Writeln('ERROR: No filename specified');
Exit;
end;
if FileExists(ParamStr(1)) then
begin
fc := TStringList.Create;
output := TStringList.Create;
Data := TMemoryStream.Create;
exporter := TSynExporterHTML.Create(Nil);
CSS := TSynCSSSyn.Create(Nil);
HTML := TSynHTMLSyn.Create(Nil);
Pas := TSynPasSyn.Create(Nil);
PHP := TSynPHPSyn.Create(Nil);
Misc := TSynAnySyn.Create(Nil);
SQL := TSynSQLSyn.Create(Nil);
XML := TSynXMLSyn.Create(Nil);
exporter.Highlighter := Misc;
if GetFileExt(ParamStr(1)) = 'css' then exporter.Highlighter := CSS;
if GetFileExt(ParamStr(1)) = 'html' then exporter.Highlighter := HTML;
if GetFileExt(ParamStr(1)) = 'htm' then exporter.Highlighter := HTML;
if GetFileExt(ParamStr(1)) = 'pas' then exporter.Highlighter := Pas;
if GetFileExt(ParamStr(1)) = 'pp' then exporter.Highlighter := Pas;
if GetFileExt(ParamStr(1)) = 'php' then exporter.Highlighter := PHP;
if GetFileExt(ParamStr(1)) = 'sql' then exporter.Highlighter := SQL;
if GetFileExt(ParamStr(1)) = 'xml' then exporter.Highlighter := XML;
exporter.ExportAsText := true;
exporter.CreateHTMLFragment := true;
fc.LoadFromFile(ParamStr(1));
exporter.ExportAll(fc);
exporter.SaveToStream(Data);
Data.Position := 0;
output.LoadFromStream(Data);
Writeln(output.Text);
exporter.Free;
CSS.Free;
HTML.Free;
Pas.Free;
PHP.Free;
Misc.Free;
SQL.Free;
XML.Free;
Data.Free;
fc.Free;
output.Free;
end
else writeln('ERROR: File does not exist');
end.
When I run this (with Interfaces) in a Shell window inside a graphical environment it does do as expected except for 2 warning lines before any output:
Gtk-WARNING **: Unable to locate loadable module in module_path: "liblighthouseblue.so",
Gtk-WARNING **: Unable to locate loadable module in module_path: "liblighthouseblue.so",