在从动态库中调用和从本地调用没有本质的区别,关键是搞清内存的分配与释放。
例:
void GetDateTimeStr(char *Date, char *Time, int *Other)
{
strcpy(Date, DateToStr(Now()).c_str());
strcpy(Time, TimeToStr(Now()).c_str());
*Other = 12345;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
char sDateBuf[20]="", sTimeBuf[20]="";
int iValue;
GetDateTimeStr(sDateBuf, sTimeBuf, &iValue);
ShowMessage(iValue);
}