Skip to content

Commit 68b314b

Browse files
update v0.2.4
1 parent a990212 commit 68b314b

47 files changed

Lines changed: 1079 additions & 26 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

en/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![banner](banner_homepage.png)
22

3-
### Nelson 0.2.3.0
3+
### Nelson 0.2.4.0
44

55
This is an pre-release of Nelson.
66

en/SUMMARY.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,25 @@
8888

8989
* [dynamic_link](./dynamic_link/README.md)
9090
* [addgateway](./dynamic_link/addgateway.md)
91+
* [libpointer datatype](./dynamic_link/C_datatype.md)
92+
* [dlcall](./dynamic_link/dlcall.md)
93+
* [dlclose](./dynamic_link/dlclose.md)
94+
* [dllibinfo](./dynamic_link/dllibinfo.md)
95+
* [dllibisloaded](./dynamic_link/dllibisloaded.md)
96+
* [dllib_used](./dynamic_link/dllib_used.md)
97+
* [dlopen](./dynamic_link/dlopen.md)
98+
* [dlsym](./dynamic_link/dlsym.md)
99+
* [dlsym_delete](./dynamic_link/dlsym_delete.md)
100+
* [dlsym_used](./dynamic_link/dlsym_used.md)
91101
* [gatewayinfo](./dynamic_link/gatewayinfo.md)
102+
* [getdynlibext](./dynamic_link/getdynlibext.md)
103+
* [libpointer](./dynamic_link/libpointer.md)
104+
* [libpointer_delete](./dynamic_link/libpointer_delete.md)
105+
* [libpointer_isNull](./dynamic_link/libpointer_isNull.md)
106+
* [libpointer_plus](./dynamic_link/libpointer_plus.md)
107+
* [libpointer_reshape](./dynamic_link/libpointer_reshape.md)
108+
* [libpointer_setdatatype](./dynamic_link/libpointer_setdatatype.md)
109+
* [libpointer_used](./dynamic_link/libpointer_used.md)
92110
* [removegateway](./dynamic_link/removegateway.md)
93111

94112

en/dynamic_link/C_datatype.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
2+
3+
# libpointer datatype
4+
5+
C/Nelson equivalent data types
6+
7+
## Description
8+
9+
10+
<p>This table shows these Nelson types with their equivalent C types.</p>
11+
<style>
12+
table, th, td {
13+
border: 1px solid black;
14+
}
15+
</style>
16+
<table style="width:100%">
17+
<tr>
18+
<th>Nelson type</th>
19+
<th>C type</th>
20+
</tr>
21+
<tr>
22+
<td>logical (scalar)</td>
23+
<td>uint8_t</td>
24+
</tr>
25+
<tr>
26+
<td>uint8 (scalar)</td>
27+
<td>uint8_t</td>
28+
</tr>
29+
<tr>
30+
<td>int8 (scalar)</td>
31+
<td>int8_t</td>
32+
</tr>
33+
<tr>
34+
<td>uint16 (scalar)</td>
35+
<td>uint16_t</td>
36+
</tr>
37+
<tr>
38+
<td>int16 (scalar)</td>
39+
<td>int16_t</td>
40+
</tr>
41+
<tr>
42+
<td>uint32 (scalar)</td>
43+
<td>uint32_t</td>
44+
</tr>
45+
<tr>
46+
<td>int32 (scalar)</td>
47+
<td>uint32_t</td>
48+
</tr>
49+
<tr>
50+
<td>uint64 (scalar)</td>
51+
<td>uint64_t</td>
52+
</tr>
53+
<tr>
54+
<td>int64 (scalar)</td>
55+
<td>int64_t</td>
56+
</tr>
57+
<tr>
58+
<td>float, single (scalar)</td>
59+
<td>float</td>
60+
</tr>
61+
<tr>
62+
<td>double (scalar)</td>
63+
<td>double</td>
64+
</tr>
65+
<tr>
66+
<td>cstring (string utf-8)</td>
67+
<td>char *</td>
68+
</tr>
69+
<tr>
70+
<td>wstring (string unicode)</td>
71+
<td>wchar_t *</td>
72+
</tr>
73+
<tr>
74+
<td>void</td>
75+
<td>void</td>
76+
</tr>
77+
<tr>
78+
<td>logicalPtr (logical vector or matrix)</td>
79+
<td>uint8_t *</td>
80+
</tr>
81+
<tr>
82+
<td>uint8Ptr (uint8 vector or matrix)</td>
83+
<td>uint8_t *</td>
84+
</tr>
85+
<tr>
86+
<td>int8Ptr (int8 vector or matrix)</td>
87+
<td>int8_t *</td>
88+
</tr>
89+
<tr>
90+
<td>uint16Ptr (uint16 vector or matrix)</td>
91+
<td>uint16_t *</td>
92+
</tr>
93+
<tr>
94+
<td>int16Ptr (int16 vector or matrix)</td>
95+
<td>int16_t *</td>
96+
</tr>
97+
<tr>
98+
<td>uint32Ptr (uint32 vector or matrix)</td>
99+
<td>uint32_t *</td>
100+
</tr>
101+
<tr>
102+
<td>int32Ptr (int32 vector or matrix)</td>
103+
<td>int32_t *</td>
104+
</tr>
105+
<tr>
106+
<td>int64Ptr (uint64 vector or matrix)</td>
107+
<td>int64_t *</td>
108+
</tr>
109+
<tr>
110+
<td>uint64Ptr (uint64 vector or matrix)</td>
111+
<td>uint64_t *</td>
112+
</tr>
113+
<tr>
114+
<td>floatPtr, singlePtr (single vector or matrix)</td>
115+
<td>float *</td>
116+
</tr>
117+
<tr>
118+
<td>doublePtr (double vector or matrix)</td>
119+
<td>double *</td>
120+
</tr>
121+
<tr>
122+
<td>voidPtr</td>
123+
<td>void *</td>
124+
</tr>
125+
<tr>
126+
<td>libpointer</td>
127+
<td>void *, uint8_t *, int8_t *, int16_t *, uint16_t *, ...</td>
128+
</tr>
129+
</table>
130+
131+
132+
## See also
133+
134+
[libpointer](libpointer.md), [dlsym](dlsym.md).
135+
## History
136+
137+
|Version|Description|
138+
|------|------|
139+
|1.0.0|initial version|
140+
141+
142+
## Author
143+
144+
Allan CORNET
145+
146+
147+

en/dynamic_link/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,25 @@ dynamic link functions
99

1010

1111
* [addgateway](addgateway.md) - Adds dynamically builtin at runtime.
12+
* [libpointer datatype](C_datatype.md) - C/Nelson equivalent data types
13+
* [dlcall](dlcall.md) - C or Fortran Foreign function call.
14+
* [dlclose](dlclose.md) - Removes dllib object.
15+
* [dllibinfo](dllibinfo.md) - Returns list of available symbols in an shared library.
16+
* [dllibisloaded](dllibisloaded.md) - Checks if shared library is loaded.
17+
* [dllib_used](dllib_used.md) - Returns list of current used dllib handle.
18+
* [dlopen](dlopen.md) - Loads an dynamic library.
19+
* [dlsym](dlsym.md) - Loads a C/Fortran symbol for an dynamic library.
20+
* [dlsym_delete](dlsym_delete.md) - Removes dlsym object.
21+
* [dlsym_used](dlsym_used.md) - Returns list of current used dlsym handle.
1222
* [gatewayinfo](gatewayinfo.md) - Returns information about an gateway.
23+
* [getdynlibext](getdynlibext.md) - Returns the extension of dynamic libraries.
24+
* [libpointer](libpointer.md) - Creates an C pointer object usuable in Nelson.
25+
* [libpointer_delete](libpointer_delete.md) - Removes libpointer object.
26+
* [libpointer_isNull](libpointer_isNull.md) - Checks if libpointer handle points on NULL pointer.
27+
* [libpointer_plus](libpointer_plus.md) - plus operator on libpointer handle.
28+
* [libpointer_reshape](libpointer_reshape.md) - Reshapes libpointer dimensions.
29+
* [libpointer_setdatatype](libpointer_setdatatype.md) - Set type of an libpointer handle.
30+
* [libpointer_used](libpointer_used.md) - Returns list of current used libpointer handle.
1331
* [removegateway](removegateway.md) - Removes dynamically builtin at runtime.
1432

1533

en/dynamic_link/SUMMARY.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
* [dynamic_link](README.md)
22
* [addgateway](addgateway.md)
3+
* [libpointer datatype](C_datatype.md)
4+
* [dlcall](dlcall.md)
5+
* [dlclose](dlclose.md)
6+
* [dllibinfo](dllibinfo.md)
7+
* [dllibisloaded](dllibisloaded.md)
8+
* [dllib_used](dllib_used.md)
9+
* [dlopen](dlopen.md)
10+
* [dlsym](dlsym.md)
11+
* [dlsym_delete](dlsym_delete.md)
12+
* [dlsym_used](dlsym_used.md)
313
* [gatewayinfo](gatewayinfo.md)
14+
* [getdynlibext](getdynlibext.md)
15+
* [libpointer](libpointer.md)
16+
* [libpointer_delete](libpointer_delete.md)
17+
* [libpointer_isNull](libpointer_isNull.md)
18+
* [libpointer_plus](libpointer_plus.md)
19+
* [libpointer_reshape](libpointer_reshape.md)
20+
* [libpointer_setdatatype](libpointer_setdatatype.md)
21+
* [libpointer_used](libpointer_used.md)
422
* [removegateway](removegateway.md)
523

en/dynamic_link/dlcall.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
3+
# dlcall
4+
5+
C or Fortran Foreign function call.
6+
7+
## Syntax
8+
9+
- [x1, ... , xN] = dlcall(dlsym_handle, arg1, ..., argN)
10+
11+
## Input argument
12+
13+
- dlsym_handle - a dlsym handle.
14+
- arg1, ..., argN - input arguments.
15+
16+
## Output argument
17+
18+
- [x1, ... , xN] - output values.
19+
20+
## Description
21+
22+
23+
<p><b>dlcall</b> calls an external C or Fortran function loaded from an shared library.</p>
24+
<p><b>dlcall</b> validates input argument types before calling based on dlsym handle definition.</p>
25+
26+
27+
## Examples
28+
29+
```matlab
30+
lib = dlopen([modulepath(nelsonroot(),'dynamic_link','bin'), '/libnlsDynamic_link', getdynlibext()]);
31+
V = double([1 2;3 4]);
32+
// C prototype:
33+
// int dynlibTestMultiplyDoubleArrayWithReturn(double *x, int size)
34+
f = dlsym(lib, 'dynlibTestMultiplyDoubleArrayWithReturn', 'int32', {'doublePtr', 'int32'});
35+
[r1, r2] = dlcall(f, V, int32(numel(V)))
36+
delete(f);
37+
delete(lib);
38+
```
39+
Call C getpid function
40+
```matlab
41+
run([modulepath('dynamic_link'), '/examples/call_c.nls']);
42+
```
43+
Call fortran DASUM (blas) function
44+
```matlab
45+
run([modulepath('dynamic_link'), '/examples/call_fortran.nls']);
46+
```
47+
48+
## See also
49+
50+
[dlsym](dlsym.md), [C/Nelson equivalent data types](C_datatype.md).
51+
## History
52+
53+
|Version|Description|
54+
|------|------|
55+
|1.0.0|initial version|
56+
57+
58+
## Author
59+
60+
Allan CORNET
61+
62+
63+

en/dynamic_link/dlclose.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
3+
# dlclose
4+
5+
Removes dllib object.
6+
7+
## Syntax
8+
9+
- dllib_delete(h)
10+
- delete(h)
11+
- dlclose(h)
12+
13+
## Input argument
14+
15+
- h - a handle: an dllib object.
16+
17+
## Description
18+
19+
20+
<p><b>dlclose(h)</b> or <b>delete(h)</b> releases dllib object.</p>
21+
<p>Do not forget to clear h afterward.</p>
22+
23+
24+
## Example
25+
26+
```matlab
27+
path_ref = [modulepath(nelsonroot(),'dynamic_link','bin'), '/libnlsDynamic_link', getdynlibext()];
28+
lib = dlopen(path_ref)
29+
isvalid(lib)
30+
dlclose(lib); // or delete(lib)
31+
isvalid(lib)
32+
```
33+
34+
## See also
35+
36+
[dlopen](dlopen.md).
37+
## History
38+
39+
|Version|Description|
40+
|------|------|
41+
|1.0.0|initial version|
42+
43+
44+
## Author
45+
46+
Allan CORNET
47+
48+
49+

en/dynamic_link/dllib_used.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
3+
# dllib_used
4+
5+
Returns list of current used dllib handle.
6+
7+
## Syntax
8+
9+
- r = dllib_used()
10+
11+
## Output argument
12+
13+
- h - a vector of dllib handle.
14+
15+
## Description
16+
17+
18+
<p>Returns list of current used dllib handle.</p>
19+
20+
21+
## See also
22+
23+
[dlopen](dlopen.md).
24+
## Example
25+
26+
```matlab
27+
dllib_used(),delete(dllib_used())
28+
```
29+
30+
## History
31+
32+
|Version|Description|
33+
|------|------|
34+
|1.0.0|initial version|
35+
36+
37+
## Author
38+
39+
Allan CORNET
40+
41+
42+

0 commit comments

Comments
 (0)