Q&A

  • VB DLL 델파이 사용
안녕하세요....

VB에서 정의된 함수입니다.

Private Declare Function Read Lib "AAA.dll" _ (ByVal AAA As Long, ByVal BBB As String) As Long

이 함수를 델파이에서 쓸려고하죠....

델파이에서 지정하기를

Function Read  (PORT : Longint;  Number : Pchar):Longint; stdcall;external AAA.dll';

이렇게 지정해서

var
    tmp: PChar;
    i : integer;
    str : STring;
begin
   i := Read ( 5 ,Pchar(tmp));
   str := strPas(str);  
end;

이렇게 썼는데
값은 잘 str에 들어갑니다...
허나 프로시저가 끝나고 나면...
Project AAA.exe raised exception class EAccessViolation with message 'Access violation at address 0040344A
in Module ' AAA.exe' Read of address 4134100'. Process stopped. Use Step or Run to continue.
이런 오류가 뜨네요..
혹시 포트를 열어놔서 그런가 닫는 처리도 해봤지만 안되고...머가 도대체 문제일까요..왜 프로시저 끝나고 오류가
나올까요 ㅜ.ㅜ; 아궁..힘드네요 ;
1  COMMENTS
  • Profile
    땅콩맨 2010.04.23 19:44
    언어가 다른 두 모듈을 서로 연결하려면
    기본 모듈을 사용해야 합니다.

    제 생각에는 tmp: PChar;를 tmp: char;으로
    변경하면 어떨지요?