[Bug libobjc/39465] New: libobjc does not find classes of DLLs
gcc-bugzilla at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Mar 15 15:34:00 GMT 2009
When building a program that uses an objc library as a DLL, libobjc
can't find its classes. When the program and the library are statically
linked, it works.
My libobjc itself is linked as a static library.
Environment:
System: Linux asgard.webkeks.org 2.6.28.5 #1 SMP Sat Feb 14 14:16:10 CET 2009
i686 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
host: mingw32
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-4.3.0-20080502/configure -v --prefix=/usr
--libexecdir=/usr/lib --program-prefix=mingw32- --target=mingw32
--with-headers=/usr/mingw32/include --without-x --disable-nls
--disable-win32-registry --disable-shared --disable-java-awt
--disable-libgcj-debug --with-gcc --with-gnu-ld --with-gnu-as --enable-threads
--enable-languages=c,c++,objc --enable-libgcj --enable-java-gc=boehm
--enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
How-To-Repeat:
asgard:/tmp$ cat foo.h
#import <objc/Object.h>
@interface MyObj: Object
- (void)foo;
@end
asgard:/tmp$ cat foo.m
#import <stdio.h>
#import "foo.h"
@implementation MyObj
- (void)foo
{
puts("foo!");
}
@end
asgard:/tmp$ cat test.m
#import "foo.h"
int main()
{
MyObj *x = [MyObj new];
[x foo];
return 0;
}
asgard:/tmp$ mingw32-gcc -shared -Wl,--out-implib,libfoo.dll.a foo.m -o
libfoo.dll -lobjc
asgard:/tmp$ mingw32-gcc -L. test.m -lfoo -lobjc
Info: resolving ___objc_class_name_MyObj by linking to
__imp____objc_class_name_MyObj (auto-import)
/usr/lib/gcc/mingw32/4.3.0/../../../../mingw32/bin/ld: warning:
auto-importing has been activated without --enable-auto-import specified on the
command line.
This should work unless it involves constant data structures
referencing symbols from auto-imported DLLs.
asgard:/tmp$ wine a.exe
objc runtime: cannot find class MyObj
------- Comment #1 from js-gcc at webkeks dot org 2009-03-15 15:34 -------
Fix:
I guess some change to libobjc is needed so it can find classes inside
DLLs.
--
Summary: libobjc does not find classes of DLLs
Product: gcc
Version: 3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libobjc
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: js-gcc at webkeks dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: mingw32
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39465
More information about the Gcc-bugs
mailing list