|
제가 책을보면서 dll 만드는 걸 공부하고 있는데 잘 안됩니다.
다음과같이 했습니다.
mydll.h
------------------
#ifndef __MYDLL_H
#define __MYDLL_H
extern "C" int __export __pascal Calc(int a,int b);
#endif
---------------------------
mydll.cpp
------------------
#include <vcl.h>
#pragma hdrstop
#include "mydll.h"
USERES("mydll.res");
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
return 1;
}
extern "C" int __export __pascal Calc(int a,int b)
{
return (a+b);
}
-------------------
위와 같이 두개의 파일을 만든후 저장하고
Project->Build ALL 하였습니다.
다음으로 해당디렉토리로 가서 도스명령으로
IMPLIB mydll mydll.dll 이라고 입력했구요..
그런다음 생성된 dll을 테스트하기 위해
프로젝트를 같은 디렉토리에서 저장하였습니다.
코드는 다음과 같구요.
#include "mydll.h"
...
...
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ShowMessage( IntToStr(Calc()) );
}
이렇게 하여 컴파일 하였더니
[LinkerError] Unresolved external 'CALC' referenced from C:\MY DOCUMENTS\DLL\UNIT1.OBJ.
위와같은 에러가 나는것입니다.
어떡해야 하나요....
|