사용자 도구

사이트 도구


develop:node:edgejs

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

develop:node:edgejs [2019/09/06 02:11] (현재)
starlits 만듦
줄 1: 줄 1:
 +====== nodejs에서 c# dll 연동하기 (edgejs) ======
  
 +
 +===== .net dll 테스트코드 =====
 +  - 파일명 : Sample105.cs <code> 
 +using System.Threading.Tasks;
 +namespace Sample105
 +{
 + public class Startup
 + {
 +  public async Task<object> Invoke(object input)
 +  {
 +   return this.Add7((int)input);
 +  }
 +
 +
 +  int Add7(int v) 
 +  {
 +   return Helper.Add7(v);
 +  }
 + }
 +
 +
 + static class Helper
 + {
 +  public static int Add7(int v)
 +  {
 +   return v + 7;
 +  }
 + }
 +}
 +</code>
 +
 +===== C# source Code Compile =====
 +  - command 명령어로 library compile 을 한다. <code>
 +E:\dev>"C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\csc.exe" /target:library /debug Sample105.cs
 +</code>
 +
 +===== node 설치 =====
 +  - node install 명령으로 node_module 를 설치한다. <code>
 +E:\dev> npm install edge-js 
 +</code>
 +
 +===== node sourceCode =====
 +  - 파일명 : edgeCall.js <code>
 +var edge = require('edge-js');
 +
 +var add5 = edge.func('Sample105.dll');
 +
 +add5(22, function (error, result) {
 + if(error) throw error;
 + console.log(result);
 +});
 +</code>
 +
 +===== edge-js 로 C# dll 호출하기 =====
 +  - node 명령을 실행한다. <code>
 +E:dev> node edgeCAll.js
 +29
 +</code>
 +
 +===== 참고링크 =====
 +  - http://tjanczuk.github.io/edge/
 +  - http://nextir.blogspot.com/2014/06/nodejs-net-dll.html
develop/node/edgejs.txt · 마지막으로 수정됨: 2019/09/06 02:11 저자 starlits