gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "weak import" on gcc


From: Luboš Doležel
Subject: Re: "weak import" on gcc
Date: Fri, 21 Jun 2013 10:10:24 +0200
User-agent: Roundcube Webmail/0.5

On Fri, 21 Jun 2013 09:39:15 +0200, Luboš Doležel wrote:
Searching on the net, it appears the attribute should be supported
since gcc 3.4 though. But I found posts about it being supported only
on certain targets

Riccardo

Hi,

my bad, it appears __attribute__((weak)) does what I wanted to achieve.

Now the question is whether this works on Windows.

I wrote a simple test program and compiled it under Windows and from disassembly I'd say it doesn't work as expected. Windows dynamic library model doesn't support it. To make methods using these block calls working on Windows, an initializer like this one may be required:

__attribute__((constructor)) void initBlocks()
{
  HMODULE hmod = GetModuleHandle(_T("libobjc2"));
  _Block_copy = GetProcAddress(hmod, "_Block_copy");
}

with _Block_copy being a function pointer.

But it has the downside of using libobjc2 specifically. Any better ideas?

--
Luboš Doležel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]