|
다음과 같은 클래스를 DLL로 만들었습니다.
typedef class TESTCLASS
{
private :
int a;
int b;
public :
TMyClass();
int getA();
int getB();
void setA(int s_A);
void setB(int s_B);
}TMyClass;
TMyClass::TMyClass()
{
a = 10;
b = 20;
}
int TMyClass::getA()
{
return a;
}
int TMyClass::getB()
{
return b;
}
void TMyClass::setA(int s_A)
{
a = s_A;
}
void TMyClass::setB(int s_B)
{
b = s_B;
}
이렇게 만들어진 DLL를 빌더6.0 APP프로젝트 하나 만들어서 추가해서 사용할려고 하는데요..
lib, dll파일 복사하고, lib 파일은 addto project해서 추가했습니다.
그런 다음에 폼에서 불러서 써볼려고 하는데요..
컴파일 하면.. 다음과 같은 에러가 뜹니다..;;
[C++ Error] Unit1.cpp(13): E2141 Declaration syntax error
[C++ Error] Unit1.cpp(18): E2451 Undefined symbol 'myClass'
[C++ Error] Unit1.cpp(18): E2303 Type name expected
[C++ Error] Unit1.cpp(18): E2379 Statement missing ;
[C++ Error] Unit1.cpp(25): E2451 Undefined symbol 'myClass'
[C++ Error] Unit1.cpp(25): E2121 Function call missing )
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TMyClass *myClass;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
myClass = new TMyClass;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ShowMessage(IntToStr(myClass->getB());
}
//---------------------------------------------------------------------------
DLL에 정의된 클래스를 폼에서 그냥 선언해서 쓸 수는 없는거 같은데요..
어떻게 해야 할지 모르겠습니다..;;;
답변 부탁드려요..^^
|