본문 바로가기
[C++] Pass value between c# and c++ by memory copy or Mashal, 메모리 카피 또는 Mashal을 이용한 c#과 c++간 변수값 주고받기 C++ DLL을 이용하여 C#에 함수를 import한 경우 c#에서 변수값을 넘겨주고 c++에서의 변경사항 또는 결과값을 넘겨준 변수값에 할당하고 싶은 경우가 있다. 그러한 경우 메모리 복사나 Mashal을 통해 해결할 수 있다. [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] public static extern (반환형) (함수명) ( ... ); 다음과 같이 C#에서 DLL의 함수를 import 했을 때, 1. 단일 값의 경우 DLL에서 import한 함수의 인자로 int, char, double, bool 같은 자료형을 넣을 경우 ref int recogNum int& recogNum 다음과 같이 인자의 형식을 지정해주면, C.. 2022. 6. 28.
[C++, OpenCV] imgproc, error C2589 한글을 출력하기 위해 UTF8을 ANSI로 변환하는 도중, 다음과 같은 에러가 났다. opencv2\imgproc.hpp(4777,27): error C2589: '(': '::' 오른쪽에 잘못된 토큰이 있습니다. opencv2\imgproc.hpp(4777): error C2144: 구문 오류: unknown-type'은(는) ')' 다음에 와야 합니다. opencv2\imgproc.hpp(4777,1): error C2660: 'cv::LineIterator::init': 함수는 2개의 인수를 사용하지 않습니다. opencv2\imgproc.hpp(4797,10): message : 'cv::LineIterator::init' 선언을 참조하십시오. opencv2\imgproc.hpp(4777): er.. 2022. 6. 10.
[C++, OpenCV] error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file) VideoWriter, .avi 확장자로 하면 can't find starting number 에러 발생 >> .mp4, .mov 등 다른 확장자로 하면 해결된다. 2022. 5. 20.