"Registering" an application

Lennart Öhman lennart.ohman@REDACTED
Thu Aug 1 23:39:09 CEST 2002



Björn Bylander wrote:
> 
> Hi,
> 
> Lennart Öhman wrote:
> > Hi Björn,
> >
> > first, the general idea is that the application directory shall be name-version.
> > E.g foo-1.0. The version may actually be any string acceptable to the file
> > system.
> >
> > As you correctly found out, a correct .app file must exist for the application
> > controller to understand what to do when you try application:start/1.
> > But the application controller uses the code-path, kept by the code-server to
> > locate .app files (and the code-server will then also use the code-path to load
> > the modules).
> >
> > See the man-page for the code module, especially code:patha.
> I couldn't find code:patha, I did find code:add_patha however. I assume
> that's what you meant.


Sorry, yes of course, add_patha adds a code path to the beginning, in contrast
to add_pathz.

> Which path should I add? "f:/code/foo" or "f:/code"?

It is the full path to the ebin directory (or directories if you wish to try
more
than one application).

> I've tried both to no avail.
> Do I need to compile the erl-file to beam first?

Yes, you must compile your source code. And as Per Bergqvist mentions there are
more sofisticated ways to work when developing larger systems. But to just try
it
out, start a shell, use the shell command cwd/1 to "go" to your source
directory.
Use the c/1 shell command to compile each file. You can also use make:all/0 but
be aware of that this will not load modules (can easily fool you when editing,
compiling, trying and then editing, compiling, trying again).
Either move the .beam files to the ebin directory, but why not move the .app
file
"here" instead and do code:add_path/1 to the src directory instead. Or you can
simply
"remain" in the src directory since "." is included in the code-path.

> 
> On a related note (as in the "trying to figure out what wrong" note), is
> there any way I can trace the calls made when evaluating application:start?
> I've tried to trace the shell process through the graphical Process
> Manager but the part where it actually tries to find my app file is not
> displayed. I guess I could use some Win32 utility to trace the system
> calls, but an Erlang way would be nicer...

Just checking, you have a module of behaviour application (containing a start
and
a stop function, pointed out by the .app file)?

You need to use pman on the application controller and turn on (I do not
remember
which button) trace all spawned processes too. The application controller will
spawn one (or was it two?) processes between itself and the top-most supervisor
of your application.

/Lennart



-------------------------------------------------------------
Lennart Ohman                   phone   : +46-8-587 623 27
Sjoland & Thyselius Telecom AB  cellular: +46-70-552 6735
Sehlstedtsgatan 6               fax     : +46-8-667 8230
SE-115 28 STOCKHOLM, SWEDEN     email   : lennart.ohman@REDACTED



More information about the erlang-questions mailing list