Thanks for your message. Regarding the pricing: DTC is a very special tool
that is not normally required to do COM programming, since DTC doesn't
provide any of the abstraction that a framework such as BlackBox offers.
It thus targets a small specialist's market which explains its price.
However, you can use the regular Component Pascal compiler in BlackBox to do
direct-to-COM programming, although in a more mundane (and unsafe) fashion.
I have attached below (following your original message) a text that explains
how.
Regarding the linker: it is part of every BlackBox version and can be used to
produce DLLs: have a look at Dev/Docu/P-S-I.odc .
Hope this helps.
Cheers,
- Clemens
http://www.fit.qut.edu.au/~szypersk/
On Thu, 19 Mar 1998, Parker Whittle wrote:
> Greetings:
>
> This is an introductory message. I'm new to the list.
>
> I've been an Oberon fan for several years, though I have never really
> developed anything serious with it. System 3 has been great fun to
> tinker with. I'm evaluating BlackBox personally (not as part of any
> company-sponsored initiative) for it's applicability in developing
> components as we move our products from a three-tiered to a more
> distributed architecture. We develop information systems for managed
> care on a WinNT/95 platform.
>
> I downloaded the education version, and discovered that the
> Direct-to-COM compiler is not included, and that it is a good deal more
> expensive than the commercial version of BlackBox. Put together, these
> two pieces are significantly more expensive than the enterprise edition
> Visual Studio suite (which includes Visual J++, MTC, SQLServer, Visual
> Basic, Visual C++, and more).
>
> There is no way that I can justify this to the bean counters here at
> HST. This pricing strategy doesn't seem to be the best approach to
> gaining mainstream acceptance for the BlackBox solution (especially with
> the imminent arrival of COM+).
>
> The documentation also mentions that one can create Windows DLLs. Since
> there is a circular reference in the Linker documentation, I seem to be
> unable to discover how to do this. If I could at least get this far,
> then I could craft vtables in Component Pascal for my COM interfaces.
>
> Any suggestions?
>
> ---------
> Parker Whittle
> Principal Engineer, Applied Research
> Health Systems Technologies, Inc.
> (206) 448-7004 x231
==== how to use the BlackBox Component Pascal compiler without DTC
==== to directly implement COM interfaces
Microsoft's Component Object Model (COM) is supported by a special
Component Pascal compiler that is available as an add-on product to
BlackBox. This compiler makes using COM safer and more convenient. However,
for casual use of COM, the approach described in this chapter can be used.
It doesn't require a special compiler version. It uses normal untagged
records and procedure variables to create COM-style method tables ("vtbl")
for objects. The following example shows how it works:
MODULE Ddraw ["DDRAW.DLL"];
TYPE
GUID = ARRAY 4 OF INTEGER;
PtrIUnknown = POINTER TO RECORD [untagged]
vtbl: POINTER TO RECORD [untagged]
QueryInterface: PROCEDURE (this: PtrIUnknown;
IN iid: GUID; OUT obj: PtrIUnknown): INTEGER;
AddRef: PROCEDURE (this: PtrIUnknown): INTEGER;
Release: PROCEDURE (this: PtrIUnknown): INTEGER;
END
END;
PtrDirectDraw = POINTER TO RECORD [untagged]
vtbl: POINTER TO RECORD [untagged]
QueryInterface: PROCEDURE (this: PtrDirectDraw;
IN iid: GUID; OUT obj: PtrIUnknown): INTEGER;
AddRef: PROCEDURE (this: PtrDirectDraw): INTEGER;
Release: PROCEDURE (this: PtrDirectDraw): INTEGER;
Compact: PROCEDURE (this: PtrDirectDraw): INTEGER;
...
SetCooperativeLevel: PROCEDURE (this: PtrDirectDraw;
w, x: INTEGER): INTEGER;
...
END
END;
PROCEDURE DirectDrawCreate* (IN guid: GUID; OUT PDD: PtrDirectDraw;
outer: PtrIUnknown) : INTEGER;
END Ddraw.
MODULE Directone;
IMPORT Type, Util, Out, Ddraw, KERNEL32, SYSTEM;
CONST
ModuleName = "Directone";
DDSCL_EXCLUSIVE = 00000010H;
DDSCL_FULLSCREEN = 00000001H;
PROCEDURE Initialize;
VAR
Handle, Addr, Res: INTEGER;
PDD: PtrDirectDraw;
nul: GUID;
BEGIN
PDD := NIL;
nul[0] := 0; nul[1] := 0; nul[2] := 0; nul[3] := 0;
Res := Ddraw.DirectDrawCreate( nul, PDD, 0 );
Out.String( "Res" ); Out.Int( Res, 8 ); Out.Ln();
Res := SYSTEM.VAL( INTEGER, PDD );
Out.String( "Res" ); Out.Int( Res, 8 ); Out.Ln();
Res := PDD.vtbl.SetCooperativeLevel( PDD, 0,
DDSCL_EXCLUSIVE + DDSCL_FULLSCREEN );
Out.String( "Res" ); Out.Int( Res, 8 ); Out.Ln();
Res := PDD.Release()
END Initialize;
BEGIN
Initialize
END Directone.
Some important points:
* COM GUIDs are 128 bit entities, not integers.
* DO NOT use ANYPTR or other BlackBox pointers for COM interface pointers.
(BlackBox pointers are garbage collected, COM pointers are referenece
counted.)
* Use pointers to [untagged] records or integers instead.
Be careful to declare all methods in the method table in the correct order
with the correct parameter list.