bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

COMer - Programming Language for Component Development (Part 1)


From: Dexterity COMer Studio
Subject: COMer - Programming Language for Component Development (Part 1)
Date: Mon, 12 May 2003 18:03:39 +0800

COMer - Programming Language for Component Development

 

If you are a Windows Programmer, I would like to introduce something interesting to you.

COMer is a native programming language for COM component development.

Part 1: The difference between COMer and C++ classes

The following is the source code of a COMer COM class:

[clsid="{EF6CD47E-B844-4219-B582-6F9FE16D45F6}",progid="Dexterity.MyC
om1.1",helpstring="DexterityCom1Class",export,unhandle]
com CMyCom1
{
[iid="{A123799B-1D8B-4efb-8D43-42AE582767C1}"]
interface IMyInterface
{
method SetValue(int dVal)
{
m_dValue = dVal;
done;
}

method GetDoubleValue(int &dVal)
{
dVal = m_dValue << 1;
done;
}
}

instvars
{
int m_dValue;
}
}

The following is the source code of a C++ class:

class CMyClass1
{
public:
HRESULT SetValue(int dVal);
HRESULT GetValue(int *pdVal); private: int m_dValue; }; HRESULT CMyClass1::SetValue(int dVal) { m_dValue = dVal; return(S_OK); } HRESULT CMyClass1::GetValue(int *pdVal) { *pdVal = m_dValue << 1; return(S_OK); }

Although the above two classes do the same thing, they are used in different ways.

COMer generates a COM component. It is a separated module (normally, it is a DLL) from the client code that uses it. Client creates the instance of the class by using the COM mechanism and call the methods of the class via the interfaces it exposes. The advantage is that the client didn't need to link with the component when it is built (no static library need). And when the component is modified, the client code don't need to be recompiled (if the interfaces do not change) and just replace the DLL is OK.

However, when using C++, classes are made within a static library. The client code is linked with the static library when it is built. Then, if the classes are modified, the whole program is need to be rebuilt again. (Although many C++ compiler supports export C++ classes from a DLL, but it is compiler specific feature. Moreover, a little static library is still need to be linked with the client code, and if the declaration of the class is changed, the client program is still need to be rebuilt. It is the same to the static library case).

So, why not start to make components by using COMer today. It will make the development of your software becomes much more easy and manageable.

For more information, please visit our web site:

Home Page:
http://www.dexterity.com.hk/COMer/

Download Trial Version:
http://www.de xterity.com.hk/COMer/Download/Download.asp

Dexterity Technologies Limited
http://www.dexterity.com.hk/

 

If you don't want to receive any more message from us, please send an e-mail to comer@dexteritytec h.com to unsubscribe.

Please don't reply this e-mail.

We apologize for any inconvenience caused.

 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]