swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Preemptive apology (was Re: using variable in [Class create: aZone])


From: Joseph & Kathleen Villa
Subject: Preemptive apology (was Re: using variable in [Class create: aZone])
Date: Fri, 07 Jan 2000 15:53:17 -0800

The answer was contained in the question: it's exactly like sel_get_uid(argSelector). After scrounging through objc-api.h, I found: Class objc_get_class (const char *name);

The proper functioning code looks like:

- (id) createAnObject: (const char*) argClass
{
        Class mClass;
        id mObject;

        mClass = objc_get_class(argClass);
        mObject = [mClass create: [self getZone]];
        return mObject;
}

Pretty cool stuff! Thanks all (and to Ginger Booth for her Tue, 29 Apr 97 15:44:24 EDT posting where she points to objc-api.h)!

Joseph.


At 03:28 PM 1/7/00 -0800, you wrote:
Greetings!

I hope this is an easy one: I'd like to have an object's class selected during it's creation using a variable. Something like:

- (id) createAnObject: (const char*) argClass
{
        id mObject;
        mObject = [argClass create: [self getZone]];
        return mObject;
}

This is clearly a no-no, since I get the following error during compilation:

address@hidden/swarm-2.0.1/cassian/system] $ make
gcc -c -g -O2 -Wall -Wno-import -Wno-protocol -Werror -DAPPNAME=cassian -DAPPV
ERSION=2.0  -DDLL -I/Swarm-2.0.1/include WorkGroupExec.m
cc1obj.exe: warnings being treated as errors
WorkGroupExec.m: In function `-[WorkGroupExec processHiringRequestInfile]':
WorkGroupExec.m:185: warning: invalid receiver type `char  []'
WorkGroupExec.m:185: invalid use of non-lvalue array
WorkGroupExec.m:185: invalid use of non-lvalue array
make: *** [WorkGroupExec.o] Error 1

QUESTIONS: Do I need to do something to make my string argument into a valid class declaration? (Similar to using sel_get_uid(argSelector) where argSelector is a const char*?)

Thanks!

Joseph.

                 ==================================
  Swarm-Support is for discussion of the technical details of the day
  to day usage of Swarm.  For list administration needs (esp.
  [un]subscribing), please send a message to <address@hidden>
  with "help" in the body of the message.



                 ==================================
  Swarm-Support is for discussion of the technical details of the day
  to day usage of Swarm.  For list administration needs (esp.
  [un]subscribing), please send a message to <address@hidden>
  with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]