Q&A

  • dll에 있는 함수 호출 시...
우선 dll은 비베로 만든거구여...

함수 원형은 아래와 같이 정의 되어 있습니다.

function aaa(dwSeqNum As  Long, UserCode As String, UserName As String, DeptCode As String, DeptName As String, CallPhone1 As String, CallPhone2 As String, CallPhone3 As String, CallName As String, ReqPhone1 As String, ReqPhone2 As String,  ReqPhone3 As String, CallMessage As String, RDate As String, RTime As String,
dwTotalPrice As Long, dwCallPrice As Long) As Long

---------------------------------------------------------------------

델파이 에서 호출 하는 부분입니다.

procedure TForm3.BitBtn4Click(Sender: TObject);
type
     TFunc = function(dwSeqNum: Cardinal; UserCode: String;
                  UserName: String; DeptCode: String; DeptName: String;
                  CallPhone1: String; CallPhone2: String;
                  CallPhone3: String; CallName: String; ReqPhone1: String;
                  ReqPhone2: String; ReqPhone3: String;
                  CallMessage: String; RDate: String; RTime: String;
                  dwTotalPrice: Integer; dwCallPrice: Integer) : Integer; stdcall;

var
     H : THandle;
     MyFunc : TFunc;
begin
     H := LoadLibrary('aaa.dll');
     if H < 32 then
     begin
          ShowMessage('DLL 로드 실패');
          Exit;
     end;
<------------------------------------------------------ 요부분까지는
                                                                                    잘 됩니다.
     @MyFunc := GetProcAddress(H,'aaa');

     if (@MyFunc = nil) then <---이부분인데요...계속 nil 을 반환하는데 뭐가
                                              문제인가여?
     begin
          ShowMessage('DLL에서 함수의 Address를 얻는데 실패 했습니다.');
          Exit;
     end;

함수 정의 하는 부분이 잘 못 된건가여?...

처버의 무지함을 용서하시고...

고수님들의 친절한 답변 부탁 드립니다...
1  COMMENTS
  • Profile
    홍성락 2002.10.24 04:12
    if (@MyFunc = nil) then 대신 if Assigned(MyFunc) then 로 해보세요
        
    hsr////////////////////////////