kdeinit compiled with gcc 4.0.1 & visibility busted at runtime
David Faure
faure at kde.org
Sun Jul 17 21:57:48 BST 2005
On Sunday 17 July 2005 13:58, Michael Nottebrock wrote:
> Found a workaround: Hand-editing the generated klauncher_dummy.cpp and doing
>
> -extern "C" int kdeinitmain(int argc, char* argv[]) { return
> kdemain(argc,argv); }
> +extern "C" __attribute__ ((visibility("default"))) int kdeinitmain(int argc,
> char* argv[]) { return kdemain(argc,argv); }
>
> fixes things. Looks like we need some additional smartness in am_edit re.
> KDE_EXPORT? Or perhaps special-casing kdeinit will be enough - I didn't
> experience similar problems anywhere else (yet).
Amazing that this didn't come up before (for other people with gcc-with-visibility-support).
How about this?
--- am_edit (revision 434767)
+++ am_edit (working copy)
@@ -868,12 +868,12 @@ sub tag_KDEINIT()
push(@progs, $kdeinit);
$lines .= "\n${kdeinit}.la.$cxxsuffix:\n";
- $lines .= "\techo 'extern \"C\" int kdemain(int argc, char* argv[]);' > ${kdeinit}.la.$cxxsuffix; \\\n";
+ $lines .= "\techo 'extern \"C\" KDE_EXPORT int kdemain(int argc, char* argv[]);' > ${kdeinit}.la.$cxxsuffix; \\\n";
$lines .= "\techo 'int main(int argc, char* argv[]) { return kdemain(argc,argv); }' >> ${kdeinit}.la.$cxxsuffix\n";
$lines .= "\n${kdeinit}_dummy.$cxxsuffix:\n";
- $lines .= "\techo 'extern \"C\" int kdemain(int argc, char* argv[]);' > ${kdeinit}_dummy.$cxxsuffix; \\\n";
- $lines .= "\techo 'extern \"C\" int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }' >> ${kdeinit}_dummy.$cxxsuffix\n";
+ $lines .= "\techo 'extern \"C\" KDE_EXPORT int kdemain(int argc, char* argv[]);' > ${kdeinit}_dummy.$cxxsuffix; \\\n";
+ $lines .= "\techo 'extern \"C\" KDE_EXPORT int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }' >> ${kdeinit}_dummy.$cxxsuffix\n";
push(@cleanfiles, "${kdeinit}.la.$cxxsuffix");
push(@cleanfiles, "${kdeinit}_dummy.$cxxsuffix");
And for unsermake:
--- kdeinit.um (revision 435684)
+++ kdeinit.um (working copy)
@@ -36,11 +36,11 @@ class KDEINIT_Handler(handlerbase.Handle
amfile.add_define('libkdeinit_' + canon_name + '_la_LIBADD',
amfile.value_of(bin.canon_name + '_LIBADD') )
- lines=["@echo 'extern \"C\" int kdemain(int, char* []);' > $@",
+ lines=["@echo 'extern \"C\" KDE_EXPORT int kdemain(int, char* []);' > $@",
"@echo 'int main( int argc, char* argv[] ) { return kdemain(argc, argv); }' >> $@"]
amfile.insertTarget(amfile.build + 'kdeinit_' + canon_name + '.cpp', [], lines)
- lines=["@echo 'extern \"C\" int kdemain(int, char* []);' > $@",
- "@echo 'extern \"C\" int kdeinitmain( int argc, char* argv[] ) { return kdemain(argc, argv); }' >> $@"]
+ lines=["@echo 'extern \"C\" KDE_EXPORT int kdemain(int, char* []);' > $@",
+ "@echo 'extern \"C\" KDE_EXPORT int kdeinitmain( int argc, char* argv[] ) { return kdemain(argc, argv); }' >> $@"]
amfile.insertTarget(amfile.build + 'kdeinit_' + canon_name + '.la.cpp', [], lines)
amfile.insertTarget("clean-kdeinit_%s" % canon_name, "",
I guess main() is treated as a special case which doesn't need KDE_EXPORT...
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list