[comp.sys.next] Run-time object loading

moose@svc.portal.com (08/14/90)

	I am looking for a way to dynamically load objects at run-time.  I want
an application that can allow people to drop in their own custom objects 
whenever they want to.  I know how to drop in interface files, I don't know 
how to drop in raw objects.  


Example
Program A lists all the "modules" in the directory /LocalApp/myApp.app/modules/.
The user double clicks on any module and a screen comes up with that .nib
	file.  The .nib file modifies the menu appropriately.
The user sits down and writes his own .nib file.  He includes custom objects
	he makes.  He compiles it and drops it in /LocalApp/myApp.app/modules/.

I want my program to be able to load this module.


Thanks,

Michael Rutman				|	moose@svc.portal.com
Cubist					|	makes me a NeXT programmer
Software Ventures			|	That's in Berkeley
smile, your on standard disclaimer	|	<fill in with cute saying>
-- 
Michael Rutman				|	moose@svc.portal.com
Cubist					|	makes me a NeXT programmer
Software Ventures			|	That's in Berkeley
smile, your on standard disclaimer	|	<fill in with cute saying>

news@midway.uchicago.edu (News Administrator) (08/14/90)

In article <1990Aug13.223632.312@svc.portal.com>, moose@svc.portal.com writes...
 
>	I am looking for a way to dynamically load objects at run-time.

I have had a recent communication with Avie about the same issue. He told me
that dynamic loading at the moment is very difficult to do, but that the
operating system 2.0 will have "turnkey" dynamic loading. So, your best bet is
to wait another 3 months, and enjoy the easy life.

Thanks, Avie.

/ivo welch	ivo@next.agsm.ucla.edu

wjs@milton.u.washington.edu (William Shipley) (08/15/90)

In article <1990Aug13.223632.312@svc.portal.com> moose@svc.portal.com writes:
>
>	I am looking for a way to dynamically load objects at run-time.  I want
>an application that can allow people to drop in their own custom objects 
>whenever they want to.  I know how to drop in interface files, I don't know 
>how to drop in raw objects.  

Currently it's pretty easy to dynamically load functions, but pretty
difficult to dynamically load objects.

Functions are easy because all you need is a pointer to them and you
can call them.  Here at Stanford Linear Accelerator I have created a
set of routines which allow the user to dynamically link in functions:
it took about 2 pages of code.  (Available on request.)

For objects, it depends on what you mean by "object".  If you want to drop
in an object of an already existing (in the target program) class, you
can just unarchive it (or do somehting similar).  If you want to dynamically
add a new class, it's harder, because you have to inform the run-time
Obj-C system all about your new class, including the size of the objects
and the methods they respond to.

This may be as easy as calling objc_addClass(), but, honestly, I have no
idea.

It hasn't been made clear to me whether 2.0 will actually support run-time
loading of new classes, or just run-time linking of new functions.

-william shipley
NeXT developer at Stanford Linear Accelerator
(student at University of Washington, too)

PS: Thanks should be given to Alan Marcum at NeXT for assistance getting
dynamic linking to work.

edwardj@microsoft.UUCP (Edward JUNG) (08/15/90)

In article <1990Aug13.223632.312@svc.portal.com> moose@svc.portal.com writes:
>
>	I am looking for a way to dynamically load objects at run-time.  I want
>an application that can allow people to drop in their own custom objects 
>whenever they want to.  I know how to drop in interface files, I don't know 
>how to drop in raw objects.  
>

I spent alot of time looking at this problem last year and came up
with a number of hack solutions (they are hacks because they rely
on undocumented, reverse-engineered information regarding shared
library and objective-C module formats).

I am told that version 2.0 of the OS will correctly support "real"
dynamic loading/linking.  I would suggest waiting for it; any other
hack is doomed to fail.

I might add parenthetically that NeXT official tech support was of
ZERO help while I was attempting this last year.  Of course I was
at a somewhat smaller company then. ;-)

My experience indicates that "knowing" somebody helps alot.  Or
flaming like a bandit.

If you are still interested in doing this, however, send me some
mail.  But you'll be sorry!

Edward Jung
Advanced Systems Architecture
Systems Strategist
Microsoft Corporation

{uunet|apple}!microsoft!edwardj
ed@dtg.com

phd_ivo@gsbacd.uchicago.edu (08/16/90)

In article <56584@microsoft.UUCP>, edwardj@microsoft.UUCP (Edward JUNG) writes...
 
+I might add parenthetically that NeXT official tech support was of
+ZERO help while I was attempting this last year.  Of course I was
+at a somewhat smaller company then. ;-)
+ 
+My experience indicates that "knowing" somebody helps alot.  Or
+flaming like a bandit.

I have zero connections and zero company support, too. However, I am very
pleased with Next's support, particularly the support that I can get by asking
questions here about the NeXT. If someone else doesn't answer first, it often
happens that some of NeXT's top technical people answer questions. I don't know
about the official support, though...

/ivo welch	ivo@next.agsm.ucla.edu