Call a compiled Beam module

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Call a compiled Beam module

Jilani Khaldi-3
Hi All,
how to load "c:\abc\mymodule.beam" from werl shell?

I have put l("/abc/mymodule.beam/").
-> Error

Thanks.
--
Jilani Khaldi
http://www.jilani.net






Reply | Threaded
Open this post in threaded view
|

Call a compiled Beam module

Vladimir Sekissov
Good day,

Please try:

code:add_path("c:/abc").
l(mymodule).

I can be wrong with slash because I've never used Erlang under Win.

Best Regards,
Vladimir Sekissov

jilani.khaldi> Hi All,
jilani.khaldi> how to load "c:\abc\mymodule.beam" from werl shell?
jilani.khaldi>
jilani.khaldi> I have put l("/abc/mymodule.beam/").
jilani.khaldi> -> Error
jilani.khaldi>
jilani.khaldi> Thanks.
jilani.khaldi> --
jilani.khaldi> Jilani Khaldi
jilani.khaldi> http://www.jilani.net
jilani.khaldi>
jilani.khaldi>
jilani.khaldi>


Reply | Threaded
Open this post in threaded view
|

Call a compiled Beam module

Jilani Khaldi-3
>Good day,
>
>Please try:
>
>code:add_path("c:/abc").
>l(mymodule).
That's Ok, but it loads only the module but not the "*.gif" images inside "c:/abc" that the module uses, and it aborts.
Any idea?

--
Jilani Khaldi
http://www.jilani.net






Reply | Threaded
Open this post in threaded view
|

Call a compiled Beam module

Ulf Wiger-4
On Thu, 8 May 2003, Jilani Khaldi wrote:

>>Good day,
>>
>>Please try:
>>
>>code:add_path("c:/abc").
>>l(mymodule).
>That's Ok, but it loads only the module but not the "*.gif"
>images inside "c:/abc" that the module uses, and it aborts.
>Any idea?

An OTPish way of doing things would be to organize your code
into applications like in the OTP code tree:

$MYROOT/lib/myapp-1.0/ebin/
                     /priv/

etc.

You can then use the function code:priv_dir(myapp) and find
$MYROOT/lib/myapp-1.0/priv/. From there, you can e.g. slap
on an imgs/ subdirectory and fetch your files.

Another method would be to maintain a variable pointing to
your personal files. This can be done in many ways.

- If you want to specify an OS environment variable, you can
  do so, and fetch the location using os:getenv(Variable)

- If you want to specify the location as an argument to
  the 'erl' command, you are free to do so:

#: erl -mydir /foo
Erlang (BEAM) emulator version 5.2.3.3 [source] [threads:0]
[kernel-poll]

Eshell V5.2.3.3  (abort with ^G)
1> init:get_argument(mydir).
{ok,[["/foo"]]}
2>

- You can store a value in Mnesia, of course


You can also use code:which(?MODULE) in your code to find
the location of your .beam file. This is a questionable
tactic, since it will be misleading if the module has been
loaded from a patch directory.

I'm sure there are other, perhaps better, ways, but those
were some alternatives off the top of my head.

/Uffe
--
Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson AB, Connectivity and Control Nodes