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


_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to