C++
int acedDefunEx( const ACHAR * pszGlobalName, const ACHAR * pszLocalName, int nFuncNum );
File
acedads.h
Description
Defines an ARX application function as an external AutoLISP function and clears any existing acedSetFunHelp() references. It is similar to acedDefun(), but takes both global and local name arguments.
If you want to set up global and local names for the same function, please use a single call to acedDefunEx(), rather than two calls to acedDefun().
Once a function in an ARX application has been defined by a call to acedDefunEx(), it can be called from AutoLISP. When AutoLISP sends an kInvkSubrMsg message to the application, the nFuncNum for the function can be retrieved by a call to acedGetFunCode(), and any arguments can be retrieved by a call to acedGetArgs(). As in AutoLISP, if the first characters of the name are C:, you can invoke the function as an AutoCAD command without enclosing its name in parentheses. You can invoke it also as a function, provided that the prefix C: is included as part of its name.
Warning: If two or more external applications define functions that have the same name, AutoLISP can recognize only the most recently defined external function. The previously loaded function will be lost.
The acedSetFunHelp() function is usually called directly after acedDefunEx() to register command line help for the defined function.
It is also common to call acedRegFunc() immedately after acedDefunEx(). This frees your application from the need to handle kInvkSubrMsg messages.
AutoLISP saves function and command names in uppercase characters, but if the name is lowercase, acedDefunEx() converts it before passing it to AutoLISP. AutoLISP binds functions defined by acedDefunEx() to the Exsubr symbol type.
Warning: If the application defines a C:XXX command whose name conflicts with a built-in command or with a command name defined in the acad.pgp file, AutoCAD does not recognize the external function as a command (though it can still be invoked as an AutoLISP external function). For example, after the call to acedDefunEx("c:cp", 0), a user input of cp invokes the AutoCAD COPY command (this alias is defined in the sample acad.pgp), but the user could invoke the external function with (c:cp).
Function names defined by acedDefunEx() can be undefined by calling acedUndef(). This removes the function name from the AutoLISP atom list. After a function has been undefined, an attempt to invoke it causes an error.
Parameters
Parameters | Description |
---|---|
pszGlobalName | Global name string that invokes the function from AutoLISP. This name should be the same across all locales. |
pszLocalName | Local name string that invokes the function from AutoLISP. This name may be locale dependent. |
nFuncNum | Non-negative number used to identify the function in subsequent kInvkSubrMsg messages from AutoLISP. |
Returns
RTNORM if successful; otherwise, an error code.