One thing which worr me slightly is:
if I replace class_get_super_class(c) by [c superclass]
I have a compiler warning:
objcsharp.m: In function `objcsharp_get_super_class':
objcsharp.m:11: warning: cannot find method
objcsharp.m:11: warning: return type for `superclass' defaults to id
it works but it seems unsafe/unsure/unmaintain/breakable!
any idea of the proper code?
----- Original Message -----
Sent: Thursday, May 19, 2005 11:02 AM
Subject: Re: bug with objc runtime (on Windows): Solved!!

It's a class initialization problem!
if I use [c1 superclass] instead of class_get_super_class(c1) it works!
now, that's annoying because [c1 superclass] is an undocumented call I'm not sure it would be always there....
any C runtime function work around?
----- Original Message -----
Sent: Thursday, May 19, 2005 10:47 AM
Subject: bug with objc runtime (on Windows)

I have a very simple ObjectiveC only program which reproduce my problem, a memory access violation after a simple lookup.
Any idea what it could be?
 
the file are attached but I copy for you the code inline.
It has this memory access violation problem while trying to display the name of the super class....
-------------------------------------------------------------------------------
#include <objc/objc-api.h>
#include <Foundation/Foundation.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
 
#define DEBUG2(x, fmt) printf("(%s:%d):%s :%s = %" #fmt "\n", __FILE__, __LINE__, __FUNCTION__, #x, x)
 
main()
{
 LoadLibrary("Kernel32");
 LoadLibrary("gnustep-base");
 
 Class c1 = objc_get_class("NSAutoreleasePool");
 DEBUG2(c1, p);
 const char * n1 = class_get_class_name(c1);
 DEBUG2(n1, s);
 
 Class c2 = class_get_super_class(c1);
 DEBUG2(c2, p);
 const char * n2 = class_get_class_name(c2);
 DEBUG2(n2, s);
 
 return 0;
}
 
_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to