2
2
This is a native nodejs extension which allows us to load dot-net assemblies, create objects and call methods on them.
3
3
4
4
## Based upon
5
- [ saary's node dotnet ] ( https://github.com/saary/node.net ) and [ v8sharp] ( http://v8sharp.codeplex.com/ )
5
+ [ saary's node.net ] ( https://github.com/saary/node.net ) and [ v8sharp] ( http://v8sharp.codeplex.com/ )
6
6
7
7
## The interface
8
8
Instantiate the module, load a dll and create a class. Currently it searches the active directory of the node process for assemblies.
9
9
10
- ''' javascript
10
+ ``` javascript
11
11
var sharp = require (' ./Sharp' ).Sharp ();
12
12
var stub = sharp .load (' StubClass.dll' );
13
13
var oc = stub .new (' StubClass.Output' );
14
- '''
14
+ ```
15
15
16
16
Then the class exposes all methods for synchronous and asynchronous callbacks.
17
17
18
- ''' javascript
18
+ ``` javascript
19
19
var list = oc .call (' ReturnList' );
20
20
// list = [17, 6, 81] // some random set of integers
21
- '''
21
+ ```
22
22
23
- ''' javascript
23
+ ``` javascript
24
24
oc .async (' ReturnObject' , function (err , data ){
25
25
console .dir (data);
26
26
});
27
- '''
27
+ ```
28
28
29
29
There is also a .methods() call to return a list of callable method names.
30
30
@@ -36,17 +36,19 @@ path. It is intended for prototyping, when you already have classes to do what
36
36
as native modules apply - if your calls are long and async, then the costs of transforming the data are a smaller fraction.
37
37
38
38
## Things that work
39
- * Listing Dlls in the current directory
39
+ * Listing dlls in the current directory
40
40
* Loading managed assemblies (doesn't have to be .dll, loading Sharp.node has all the fun generated internals)
41
41
* Call zero argument constructors
42
42
* Calling methods where types can be converted
43
43
44
44
Speaking of - type conversion (mostly inherited from v8sharp)
45
- ** string
46
- ** int
47
- ** date -> datetime
48
- ** arrays -> typed arrays and lists
49
- ** object -> dictionary of string and objects, and objects with public properties.
45
+
46
+ * string
47
+ * int
48
+ * date -> datetime
49
+ * arrays -> typed arrays and lists
50
+ * object -> dictionary of string and objects, and objects with public properties.
51
+ * returned objects are returned
50
52
51
53
## What's next?
52
54
From the previous list, there are many things which could be added to make the process a little more seamless.
0 commit comments