라미엘 님이 쓰신 글 :
: 아래의 비쥬얼C++(6.0)소스는 dll개발사에서 배포한 샘플코드인데 델파이로 코딩을하니 에러가 납니다. ScanParameter구조체에서 short을 델파이에서 smallInt로 변경한 것때문인지 reserved배열 문제인지 원인을 모르겠습니다. BK_SetScanParameter(iScanParameter);함수를 호출하면 Access Violation에러가 납니다.
:
: 고수님들 해결방법 좀 부탁드립니다.
:
:
: //VC++
: #ifndef BKV3_API
: #define BKV3_API __declspec(dllimport)
: #endif
: typedef struct
: {
: short Left;
: short Top;
: short Width;
: short Length;
: short xResolution;
: short yResolution;
: short reserved[10];
: } ScanParameter;
:
:
: BKV3_API int WINAPI BK_SetScanParameter(ScanParameter *pScanParam);
:
: void aaDlg::OnScan()
: {
: ScanParameter pScanParam;
: BK_SetScanParameter(&pScanParam);
: }
:
:
:
: //델파이
:
PScanParameter = ^ScanParameter;
: ScanParameter = record
: Left : Smallint;
: Top : Smallint;
: Width : Smallint;
: Length : Smallint;
:
: xResolution : Smallint;
: yResolution : Smallint;
: reserved : Array [0 .. 9] of Smallint;
: end;
:
: function BK_SetScanParameter(pScanParam : PScanParameter)):integer
: cdecl; external 'BKV3.dll';
:
: procedure TForm1.Button1Click(Sender: TObject);
: var iScanParameter : PScanParameter ;
: begin
New(iScanParameter);
: iScanParameter^.Left := 10;
: iScanParameter^.Top := 20;
: // ...기타 셋팅 ...//
: BK_SetScanParameter(iScanParameter);//dll함수 호출: Access Violation에러
Dispose(iScanParameter);
: end;
|