Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[8247] [질문]Visual C++ DLL을 델파이에서 사용
단테 [] 2415 읽음    2002-07-26 18:06
안녕하십니까.
델파이를 시작한지 얼마안된 초보입니다.

비주얼씨로 Dll을 만들어서 델파이에서 사용하려고 합니다.
해더파일없이 CPP로만 함수를 만들어서 Dll을 만들었습니다.

========================================소스==============================================

// TestDll.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include <afxdllx.h>


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


static AFX_EXTENSION_MODULE TestDllDLL = { NULL, NULL };

extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    // Remove this if you use lpReserved
    UNREFERENCED_PARAMETER(lpReserved);

    if (dwReason == DLL_PROCESS_ATTACH)
    {
        TRACE0("NODEDLL.DLL Initializing!\n");
       
        // Extension DLL one-time initialization
        if (!AfxInitExtensionModule(NodeDllDLL, hInstance))
            return 0;

        // Insert this DLL into the resource chain
        // NOTE: If this Extension DLL is being implicitly linked to by
        //  an MFC Regular DLL (such as an ActiveX Control)
        //  instead of an MFC application, then you will want to
        //  remove this line from DllMain and put it in a separate
        //  function exported from this Extension DLL.  The Regular DLL
        //  that uses this Extension DLL should then explicitly call that
        //  function to initialize this Extension DLL.  Otherwise,
        //  the CDynLinkLibrary object will not be attached to the
        //  Regular DLL's resource chain, and serious problems will
        //  result.

        new CDynLinkLibrary(NodeDllDLL);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
        TRACE0("TESTDLL.DLL Terminating!\n");
        // Terminate the library before destructors are called
        AfxTermExtensionModule(TestDllDLL);
    }
    return 1;   // ok
}

extern "C" __declspec(dllexport) void __cdecl Test()
{


}

위 소스와 같이 함수안에는 아무내용도 없습니다.
이 함수를 델파이에서 정의하는 부분과 호출하는 부분입니다.

=======================================소스===============================================
implementation
  const NODEDLL = 'TestDll.dll';

  procedure Test(); cdecl; external NODEDLL;

procedure TmainForm.FormCreate(Sender: TObject);
begin
  Test;
end;

위와같이 코딩을 하였습니다.
컴파일과 실행은 잘 돼었습니다.

하지만, Visual C++에서 DLL을 수정하여 DLL파일이 있는 폴더에 OverWrite 하면,
DLL파일이 열려있어 복사할 수 없다는 메시지가 나옵니다.

왜이런 일이 생긴는지 저로써는 알수 있는 방법이 없습니다.
그럼 많은 조언부탁드립니다. 수고하십시오.

+ -

관련 글 리스트
8247 [질문]Visual C++ DLL을 델파이에서 사용 단테 2415 2002/07/26
9245     Re:[질문]Visual C++ DLL을 델파이에서 사용 박종민.BacTeria 1261 2002/07/26
9244     Re:[질문]Visual C++ DLL을 델파이에서 사용 박종민.BacTeria 1190 2002/07/26
9243     Re:[질문]Visual C++ DLL을 델파이에서 사용 박종민.BacTeria 1296 2002/07/26
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.