본문 바로가기
C#

[C#] 델파이 dll 호출

by Jcoder 2020. 11. 19.

using System;

using System.IO;

using System.Runtime.InteropServices;

 

namespace Delphi_Dll_Test

{

   class Program

   {

      [DllImport("RecEncryptDLL_x64.dll"CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)]

      public static extern bool Decrypt_FileToFile(string keyFile, string sourceFile, string Targetfile, string msg);

// 델파이에서 선언한 name으로 호출

      [DllImport("RecEncryptDLL_x64.dll"CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)]

      public static extern bool EnCrypt_FileToFile(int algorithm, string keyFile, string sourceFile, string Targetfile, string msg);

// 델파이에서 선언한 name으로 호출

 

      static void Main(string[] args)

      {

         string msg = null;

 

         Decrypt_FileToFile(@"C:\test.key"@"C:\Users\JSH\Desktop\암호화1.wav"@"C:\Users\JSH\Desktop\복호화1.wav", msg);

 

         Console.WriteLine(msg);

 

         EnCrypt_FileToFile(0@"C:\test.key"@"C:\Users\JSH\Desktop\복호화2.wav"@"C:\Users\JSH\Desktop\암호화2.wav", msg);

         Console.WriteLine(msg);

 

         Console.WriteLine("Hello World!");

         

      }

   }

}

'C#' 카테고리의 다른 글

[C#] FFMpeg.exe 사용 (m4a -> wav)  (0) 2020.11.19
[C#] CMD 사용  (0) 2020.11.19
15. 파일 보기  (0) 2019.03.20
14. 파일 읽기/쓰기  (0) 2019.03.20
13. 프로세스 보기  (0) 2019.03.20