Created
September 17, 2010 16:55
-
-
Save torarnv/584533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "foo.h" | |
template<Type type> | |
void TemplateClass<type>::exportedMemberFunction() | |
{ | |
} | |
template void TemplateClass<Foo>::exportedMemberFunction(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef EXPORT | |
#define EXPORT __attribute__((visibility("default"))) | |
#endif | |
enum Type { | |
Foo, | |
}; | |
template<Type type> | |
class TemplateClass | |
{ | |
public: | |
inline TemplateClass() { }; | |
EXPORT virtual void exportedMemberFunction(); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define EXPORT | |
#include "foo.h" | |
int main(int, char**) | |
{ | |
TemplateClass<Foo> foo; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: compile | |
clean: | |
rm -f *.o *.dylib *.app | |
compile: lib app | |
lib: clang-lib gcc-lib | |
clang: clang-lib clang-app | |
clang-lib: | |
clang++ -c foo.cpp -o foo.clang.o -fvisibility=hidden -fvisibility-inlines-hidden | |
clang++ -dynamiclib foo.clang.o -o libfoo.clang.dylib | |
gcc: gcc-lib gcc-app | |
gcc-lib: | |
g++ -c foo.cpp -o foo.gcc.o -fvisibility=hidden -fvisibility-inlines-hidden | |
g++ -dynamiclib foo.gcc.o -o libfoo.gcc.dylib | |
app: clang-app gcc-app | |
gcc-app: gcc-lib | |
g++ -c main.cpp -o main.gcc.o | |
g++ main.gcc.o -lfoo.gcc -L. -o main.gcc.app | |
clang-app: clang-lib | |
clang++ -c main.cpp -o main.clang.o | |
clang++ main.clang.o -lfoo.clang -L. -o main.clang.app | |
nm: lib | |
nm *.o | c++filt | |
nm *.dylib | c++filt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment