|REBOL 3 Docs||Guide||Concepts||Functions||Datatypes||Errors|
|TOC < Back Next >||Updated: 26-Jul-2010 Edit History|
The previous section defined extensions as a package that can contain both REBOL and C code and data. This section explains how to import and use extensions.
When you import an extension, you load its code and data, which can include both REBOL or C code, as well as any data they might need, such as graphics, images, sounds, tables, or whatever.
To import an extension called example you would write:
Notice that the file suffix is .dll - a dynamically loaded library. This is how native functions and their data are able to be loaded by your operating system.
The line above will perform these steps to import the extension:
See modules for more detailed information about how some of these steps are processed.
Once an extension has been imported, you can use its exported function as you would any other type of function:
import %example.dll ; exports add-mul print add-mul 1 2 3 9
If you want to see the exported definition of the example extension, just type:
probe import %example.dll
This will show you the module header and a list of all its functions and data.
Also, just like modules, you can explicitly reference a command function with an extension:
mysql: import %r3-mysql.dll sql: mysql/open %books.db mysql/select sql * 'authors
This is identical to how you reference a field of an object.
|TOC < Back Next >||REBOL.com - WIP Wiki||Feedback Admin|