ben 님이 쓰신 글 :
: dll 함수를 호출 하지 않았을 땐, 정상적으로 잘 동작하는데..
:
: dll 함수를 호출 하게 되면 오른쪽 모냥처럼 이상하게 실행되고 동작은 잘 되지만, 종료할때 항상 아래 그림처럼 에러가 발생합니다.
:
: 왜그런지 모르겠어서 이렇게 글을 올립니다. 음..
:
: dll 은 내부적으로 클래스로 구현되어 있습니다. 뭐 그냥 cpp 로 잘 쓰던 모듈입니다. 허흑;;
: 뭐 간단하게 함수 만들어서 호출해도 똑같은 현상입니다.
:
: 왜 그럴까요.. ㅠㅠ;;
:
:
: // dll을 사용하는 app 쪽입니다.
:
: #pragma comment(lib, "ctr_socket.lib");
: #include "..\ClientTypeSocketDll.h" // 아래쪽에 해더파일입니다.
:
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
: : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
: void __fastcall TForm1::BitBtn1Click(TObject *Sender)
: {
:
: DLL_TEST();
: dll_test2_test2(10); // 함수호출은 정상적으로 잘됩니다
: }
:
:
:
:
:
: #ifndef __CLIENTTYPE_SOCKET_H__
: #define __CLIENTTYPE_SOCKET_H__
:
:
: #include "GrobalDefine.h"
:
: #define WINSOCK_CLIENTSOCK 0
: #define INDYSOCK_CLIENTSOCK 1
:
:
: #ifdef __cplusplus
: extern "C" {
: #endif
:
:
: #ifdef CALLER_IMPORT
: #define __CALLEE_API__ __declspec(dllimport)
: #else
: #define __CALLEE_API__ __declspec(dllexport)
: #endif
:
:
: __CALLEE_API__ void __stdcall DLL_TEST(void);
: __CALLEE_API__ void __stdcall dll_test2_test2(int a);
:
: #ifdef __cplusplus
: }
: #endif
:
:
: #endif
:
#pragma comment(lib, "ctr_socket.lib");
이건 이렇게바꾸세요
#pragma link "crt_sorket.lib";
이걸로 바꾸세요
그리고 라이브러리 파일을 빌더에포함시키시고
라이브러리 경로를 맞춰주세요 파일이있는위치욘
__CALLEE_API__ void __stdcall DLL_TEST(void);
__CALLEE_API__ void __stdcall dll_test2_test2(int a);
이부분에서 저같은경우는
extern "C" __CALLEE_API__ void __stdcall DLL_TEST(void);
extern "C" __CALLEE_API__ void __stdcall dll_test2_test2(int a);
이렇게 하고있어요
감싸지않고 따로 쓰고있어요
|