Managed code Unmanaged code C C Function C

  • Slides: 7
Download presentation
Managed code와 Unmanaged code 김진태

Managed code와 Unmanaged code 김진태

C#에서 C++ Function 호출 • • C#에서 DLLImport 를 사용하여 C++의 dll을 로딩 C#코드

C#에서 C++ Function 호출 • • C#에서 DLLImport 를 사용하여 C++의 dll을 로딩 C#코드 using System. Runtime. Interop. Services; // DLLImport를 사용하기 위한 namespace Console. Application { class Program { } • } [Dll. Import(“test. dll”)] public static extern int fntext 3(); // c++ function과 같은 type으로 선언한다. static void Main(string[] args] { Console. write(fntest 3()); } C++코드 extern “C” __declspec(dllexport) int fntest 3(void) { return 10; } ※ extern “C” 키워드가 없을 경우 함수 이름이 변형되므로 C#에서 사용이 불가능하다.

참조 • http: //tang 2. tistory. com/entry/C에서-C-호 출하기 • http: //kindtis. tistory. com/66

참조 • http: //tang 2. tistory. com/entry/C에서-C-호 출하기 • http: //kindtis. tistory. com/66