请教各位富翁怎样在Delphi下调用C++的DLL(200分)

L

licse

Unregistered / Unconfirmed
GUEST, unregistred user!
本人做了一个API,除供VC自己调用外,还要提供给Delphi用户使用,诚心请教,在不用UNICODE情况下,怎样设计VC的类既可以供Vc使用也可以给Delphi使用,以及在Delphi下如何使用,先谢啦!

class __declspec (dllexport) CMessage
{
public:
CMessage();
CMessage(const CMessage &
Msg);
CMessage &
operator = (const CMessage &
Msg);
public:
inline void SetSequence(const USHORT Sequence);
inline void SetDestination(const BYTE Destination = CONSOLE_MODULE);
inline void SetSource(const BYTE Source = OPERATOR_INTERFACE);
inline void SetMsgType(const USHORT MsgType);
inline void SetMsgLen(const USHORT MsgLen);
inline void SetBuf(const PTSTR buf);
inline const USHORT GetSequence() const;
inline const BYTE GetDestination() const;
inline const BYTE GetSource() const;
inline const USHORT GetMsgType() const;
inline const USHORT GetMsgLen() const;
protected:
USHORT len;
USHORT type_id;
BYTE src;

BYTE dst;

USHORT seq;
char buf[100];

};
 
用函数接口吧,类好象不行
 
这样子,如果是DLL,那么 extern "c" _stdcall __declspec (dllexport),其实你可以做成COM来方便一些.
 
顶部