[erlang-patches] exporting a new function in prim_file.erl
Wed Apr 21 18:26:57 CEST 2010
On 21 April 2010 18:18, Filipe David Manana <> wrote:
> I'm trying to add a new function to prim_file.erl that will be called by
> file_io_server.erl. Therefore I export it in the first export macro.
> This new function happens to have exactly the same interface (arity and arg
> type, return values) as prim_file:sync/1, so I copied the sync function
> clause, renamed it, and added the corresponding export.
> After building and installing OTP, I get an error when calling
> =ERROR REPORT==== 21-Apr-2010::16:30:53 ===
> Error in process <0.35.0> with exit value:
> file:my_func/1 just calls file_io_server:my_func/1 wich in turn calls
> It seems that prim_file is not exporting my_func. Yet I have an explicit
> "-define([... sync/1 my_func/1 ...])."
This, -define, is used to define macros, not for exporting functions
from a module. It should be:
-export(([... sync/1 my_func/1 ...]).
There is an export declaration already which exports the old
functions. It is perfectly ok to have many export declaration, I use
that to cluster various "classes" of exported functions.
More information about the erlang-patches