Skip to content

Commit

Permalink
Update 13-Creating-and-Using-Packages.md
Browse files Browse the repository at this point in the history
Sorry this took so long, Edited and made more professional a grammatical though.
  • Loading branch information
Ethaaan11 authored Oct 24, 2023
1 parent 8aab41b commit 2eae091
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions 13-Creating-and-Using-Packages.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Packages in Coda provide a convenient way to organize and reuse code. They allow you to encapsulate related functionality and share it across your projects. In Coda, packages can take two forms: `.coda` packages and `.dll` (Dynamic Link Library) packages. This wiki page will explain how to use and implement packages in Coda.
Coda packaging provides a convenient and efficient means to organize and reuse code. Their functionality allows you to encapsulate related integration and share it across your various projects. In Coda, packages can take one of two formats: `.coda` packages and `.dll` (Dynamic Link Library) packages. This wiki page will explain how to use and implement packages in Coda.

## .coda Packages

Expand All @@ -21,9 +21,9 @@ scope Maths {

```

### Using a .coda Package
### How to use a .coda Package

To use a `.coda` package within your Coda project, you can simply import the respective `.coda` file:
To integrate a `.coda` package within your Coda project, simply import the respective `.coda` file as shown below:

```js
import Maths;
Expand All @@ -35,12 +35,12 @@ let result = Maths.add(5, 3); // Calls the 'add' function from the Maths package

### Creating a .dll Package

`.dll` packages are compiled dynamic link libraries containing reusable code. These packages may also include a `.coda` file for documenting the package's functionality. To create a `.dll` package:
`.dll` packages are compiled dynamic link libraries which contain reusable code. These packages may also include a `.coda` file for documenting the package's functionality. To create a `.dll` package:

1. Compile your code into a `.dll` file (e.g., `Maths.dll`) using the appropriate tools for your programming language.
The source for a DLL file should contain functions with the same signature;
`extern "C" __declspec(dllexport) void coda_<function_name_goes_here>(IValuePtr res, IValuePtr args, IEnvironment * env);`
Find the Interfaces in FFI directory of this repo.
(You may find the Interfaces in the FFI directory of this repo).

2. Create a `.coda` file that describes the package's functions and variables.
```js
Expand All @@ -51,9 +51,9 @@ scope Maths{
}
```
### Using a .dll Package
### How to use a .dll Package
To use a `.dll` package, you'll need to import the corresponding `.coda` file and make sure the `.dll` file is in the same directory as your executable files.
To apply a `.dll` package, you will need to import the corresponding `.coda` file and ensure the `.dll` file is located in the same directory as your executable files.
```js
import Maths;
Expand All @@ -63,6 +63,6 @@ let result = Maths.sqrt(23); // Calls the 'sqrt' function from the Maths.coda wh
## Directory Organization
When working with packages, remember to keep the `.coda` and `.dll` files organized. If it's a `.coda` package, place it in your source code directory. For `.dll` packages, ensure the `.dll` file is located in the same directory as your Coda executable files.
When working with packages, it is important to keep the `.coda` and `.dll` files well organized. For `.coda` packages, place it in your source code directory while for `.dll` packages, ensure the `.dll` file is located in the same directory as your executable Coda files.
Packages in Coda provide a clean and modular way to manage your code, facilitating code reuse and organization in your projects.
In summary, Coda's package sytstem provides a cleanly structured and modular approach to managing your code, facilitating code reuse and efficient organization within your projects.

0 comments on commit 2eae091

Please sign in to comment.