From: Ronald P. <pij...@ds...> - 2010-05-28 20:06:05
|
> Hi Danny, > > [...] > > > This works for me: > > gcc -static small.m -lobjc > > > > There are upstream gcc problems with the build of libobjc-2.dll. Namely, > > the script to build the dll is bit-rotten (and has been so for a looooong > > time (~10 yrs)). Building the dll without the > > > > # ifdef DLL_EXPORT /* defined by libtool (if required) */ > > # define objc_EXPORT __declspec(dllexport) > > # define objc_DECLARE __declspec(dllexport) > > #else > > # define objc_EXPORT extern __declspec(dllimport) > > # define objc_DECLARE extern __declspec(dllimport) > > #endif > > > > business in src/libobjc/objc/objc-decls.h > > and just relying on the default --export-all works for me, but I know > > hardly anything about objc. > > > > I think the gnustep folk had something more elegant. (back in 1998/99) but > > ... golly, there have been a few brain cells gone AWOL since then. > > For gcc 4.4.0 I resolved the problem with the shipped objc runtime library by > linking it myself (see http://article.gmane.org/gmane.comp.gnu.mingw.user/30263). > > The process for getting this done was so elaborate however, that I would welcome > a pre-built libobjc.dll from the downloads directory. After all: what is the use of > having the download there if it is broken anyway. > > In the meantime the stock gcc Makefile to build libobjc.dll seems to have been cleaned of the > bit-rotten stuff, so I would expect that the libobjc.dll would just work. > However, maybe the --export-all flag should be added to make it work. > If so, would it not be a good idea to add this as a default linker flag to the libobjc Makefile? After some fiddling around I was able to find the source of the issue, which seems to be libtool. Although it is supposed to export all symbols by default, it does not seem to do this. A simple workaround is to add the line: -export-symbols-regex .+ to the link line of libobjc.la. See also the report on the gcc mailing list: http://gcc.gnu.org/ml/gcc-help/2010-05/msg00334.html Maybe this could be applied by default to the next version of libobjc.dll? Thanks, Ronald |