@@ -10544,6 +10544,8 @@ tests/webtbs/tw16861.pp svneol=native#text/plain
tests/webtbs/tw16863.pp svneol=native#text/plain
tests/webtbs/tw16874.pp svneol=native#text/plain
tests/webtbs/tw16901.pp svneol=native#text/plain
+tests/webtbs/tw16949a.pp svneol=native#text/plain
+tests/webtbs/tw16949b.pp svneol=native#text/plain
tests/webtbs/tw1696.pp svneol=native#text/plain
tests/webtbs/tw1699.pp svneol=native#text/plain
tests/webtbs/tw1709.pp svneol=native#text/plain
@@ -186,9 +186,8 @@ implementation
if (
assigned(current_procinfo.procdef.localst) and
(current_procinfo.procdef.localst.symtablelevel=main_program_level) and
- (current_module.is_unit)
- ) or
- islibrary then
+ (current_module.is_unit or islibrary)
+ ) then
begin
if (token=_END) then
@@ -0,0 +1,19 @@
+{ %norun }
+{ %target=win32,win64,wince,darwin,linux,freebsd,solaris,beos}
+
+library tw16949a;
+{$mode objfpc}{$H+}
+function foo: LongInt; cdecl;
+var
+ x: LongInt = 12345;
+begin
+ Result := x;
+end;
+exports
+ foo;
+end.
@@ -0,0 +1,21 @@
+{ %needlibrary }
+program ptest;
+{$ifdef fpc}{$mode objfpc}{$H+}{$endif fpc}
+const
+{$if defined(windows) or defined(mswindows)}
+ libname='tw16949a.dll';
+{$else}
+ libname='tw16949a';
+ {$linklib tw16949a}
+{$ifend}
+function foo: LongInt; cdecl; external libname;
+ if foo<>12345 then
+ halt(1);