A component constructor is automatically generated for modules that
correspond to a coclass declaration in the IDL specification.
When called, it takes care of creating the COM binary representation
of a Haskell component instance:
foreign export stdcall "new" new :: Pointer GUID -> Pointer (Pointer Interface) -> IO HRESULT
new :: Pointer GUID -> Pointer (Pointer Interface) -> IO HRESULT
new piid ppvObject = do
state <- IntRef.new
hr <- mkIIntRef_iptr state piid ppvObject
return hr
mkIIntRef_iptr :: a -> IO (Pointer Interface)
It calls the user-defined component constructor, IntRef.new,
before calling mkIIntRef_iptr which creates the COM binary
representation of the object.
The object constructor isn't a method of the component, but since it
is likely to be called from C/C++ code, a foreign export
declaration is used to give it an external calling interface.