[fpc-pascal] Unit initialization in dll initialization for arm/WinCE

kyan alfasud.ti at gmail.com
Tue Jun 12 14:14:07 CEST 2012

OK, I apologize. It seems that the problem lies elsewhere. The fact
that library initialization seems to be deferred until you do a
GetProcAddress() confused me. The problem is that function
GetModuleName() is stubbed out in WinCE (and Linux):

unit SysUtils.inc;

function GetModuleName(Module: HMODULE): string;
{$ifdef MSWINDOWS}
  SetLength(Result,GetModuleFileName(Module, Pchar(Result),Length(Result)));

The function GetModuleFileName() exists (although it is unicode) in
WinCE: http://msdn.microsoft.com/en-us/library/ms908441.aspx

And from what I've found in the web a Linux implementation is possible
using dladdr().

On Mon, Jun 11, 2012 at 1:53 PM, Sven Barth <pascaldragon at googlemail.com> wrote:
> Am 11.06.2012 12:25, schrieb kyan:
>> Does unit initialization in libraries (.dll files) work in arm/WinCE?
> From the startup code of arm-wince I don't see why it should not work...
>> Somehow it seems that even code placed in the library initialization
>> begin end block isn't executed either.
> How did you test this?
>> I found some bug reports (e.g.
>> 0019404) suggesting that this didn't work for arm/Linux but it has
>> been added to the trunk. But not for arm/WinCE?
> Linux and Windows have different schemes for library initialization, so even
> if it was the case that arm-wince did not work it would not help to apply
> the fix for arm-linux there as well.
> Regards,
> Sven
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list