Andrew W. Nosenko wrote, On 16.10.2010 2:50: > 2010/10/16 Andrew W. Nosenko <andrew.w.nosenko@xxxxxxxxx>: >> 2010/10/15 VÃclav Haisman <v.haisman@xxxxxxxxxx>: >>> Hi. >>> >>> I am having difficulty testing for compiler features like >>> __declspec(dllimport) and switches like -Wall or -Werror. >>> >>> The problem has started like this. I wanted to test compiler for >>> __declspec(dllimport) (for Windows) and if that fails for >>> __attribute__((visibility("default"))) (for *nix/GCC). With GCC this works >>> because it does support both, it supports __declspec(dllimport) even outside >>> Windows. But with e.g. Clang, this fails. Clang accepts the code of the >>> test-case with just warning like: >>> >>> "conftest.cpp:20:12: warning: 'dllexport' attribute ignored" >>> >>> The test-case passes but the compiler does not support the feature. >> >> Can you inspect the resulting object file somehow (sorry, I'm not a >> Windows guru)? For example by trying to use result like the >> program-customer intended to do. I.e. in the case of windows try to >> build trivial dll, the program-user and link them together (and, >> possible, run)? Well, on Windows I don't have to do any testing, all compilers support the syntax. The problematic platforms are the non-Windows ones. I guess that trying to inspect symbol table and their type using nm or objdump could work. Assuming nm or objdump and their output format are standard enough. >> > > BTW: why you need at all to pass __dllexport on non-Windows platform > (and therefore bother whether Unix-only compiler under [again] Unix > igrores it? The declspec __declspec({dllexport,dllimport}) attribute is avaialable on more than just Windows. It is also support by e.g. aCC compiler on HP-UX. > > Similar about "visibility default". OK, "visibility hidden" could be > useful under some circumstances and for some goals. But "default"? > (Assuming that you didn't bring all source into "hidden" or something > like that.) The idea is exactly like that, making all symbols hidden and exporting only those of the public interfaces. With GCC, this is done using combination of -fvisibility=hidden GCC option and __attribute__((visibility("default"))) in code.
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf