Both sides previous revision
Previous revision
Next revision
|
Previous revision
Next revision
Both sides next revision
|
manual:chapter4:libs [2018/03/02 09:42] claudio |
manual:chapter4:libs [2018/03/02 09:43] claudio |
* After testing a library, remember to ''DETACH'' it before trying to edit its code in the source directory. Remember that the variables are named exactly like the library commands, and if the library is attached, those names will be compiled to call the installed library, rather than the intended name identifier. This will not be visible to the user, the code will look identical but ''CRLIB'' will not be able to scan the names to include the subroutine. | * After testing a library, remember to ''DETACH'' it before trying to edit its code in the source directory. Remember that the variables are named exactly like the library commands, and if the library is attached, those names will be compiled to call the installed library, rather than the intended name identifier. This will not be visible to the user, the code will look identical but ''CRLIB'' will not be able to scan the names to include the subroutine. |
| |
* When creating new versions of a library, always add commands **at the end** of the ''$VISIBLE'' list. People using your library will have their own programs compiled with library pointers, which internally use the library ID and the index into the ''$VISIBLE'' list to refer to your commands. If the order of the commands change on the new version, user programs compiled for previous versions of the library will call the wrong command. | * When creating new versions of a library, always add commands **at the end** of the ''$VISIBLE'' list. People using your library will have their own programs compiled with library pointers, which internally use the library ID and the index into the ''$VISIBLE'' list to refer to your commands. If the order of the commands change on the new version, user programs compiled for previous versions of the library will call the wrong command. If desired, create a custom ''$MENU'' to organize the commands in a different order as ''$VISIBLE''. |
| |
| |
=== Sample library "Hello world!" === | === Sample library "Hello world!" === |
| |
To create the library, first create an empty directory: '''helloLIB' CRLIB'' and go into it. This library will have a single command ''HWORLD'' that puts the message "Hello world!" on the stack. | To create the library, first create an empty directory: '''helloLIB' CRDIR'' and go into it. This library will have a single command ''HWORLD'' that puts the message "Hello world!" on the stack. |
| |
Create the variables needed inside the directory: | Create the variables needed inside the directory: |