Hey all, i have to make an appeal for help here. I hacked out the directdraw 6 com's into an include file and are trying to test it out. Masm is giving me a very amibigous error that tells me nothing real. I have been trying to trap the cause for 3 hours and cant find it.. Im suspicious if its a text length thing with the symbol names.. Anywho i cant see any probs, Here is the code:


sCLSID_DirectDraw  \
   TEXTEQU <{0D7B70EE0h, 04340h, 011CFh, \
   {0B0h, 063h, 000h, 020h, 0AFh, 0C2h, 0CDh, 035h}}>

sIID_IDirectDraw    \
   TEXTEQU <{06C14DB80h, 0A733h, 011CEh, \
   {0A5h, 021h, 000h, 020h, 0AFh, 00Bh, 0E5h, 060h}}>

IDirectDraw_ReleaseProto typedef proto \
                      IDirectDraw_ReleaseProto :DWORD

IDirectDraw_Release typedef ptr \

_vtIDirectDraw MACRO CastName:REQ
&CastName&_QueryInterface  IDirectDraw_QueryInterface ?
&CastName&_AddRef IDirectDraw_AddRef ?
&CastName&_Release IDirectDraw_Release ?

IDirectDraw STRUCT
  _vtIDirectDraw IDirectDraw
IDirectDraw ENDS

  pIID_DDRAW   GUID sIID_IDirectDraw

   ppDDRAW dd ?


  ; ############ Initialize ############## 
  ;invoke CoInitialize, NULL
  ;invoke CoCreateInstance, addr CLSID_DDRAW, NULL,\
  ;            CLSCTX_SERVER, addr pIID_DDRAW, addr ppDDRAW 
  invoke DirectDrawCreate, NULL, addr ppDDRAW, NULL
     .if (eax!=DD_OK)

  ; ############ Destroy ##############
  ;mov edx, ppDDRAW
  ;mov edx, 
  ;invoke (IDirectDraw PTR ).IDirectDraw_Release, ppDDRAW
  coinvoke ppDDRAW, IDirectDraw, Release                ; LINE (293)
  invoke CoUninitialize
There is really no point to the program, its mearly a stepping stone to know i have COM's opened and ready. As you can see i have been trying to force the coinvoke, cause this is where the bug creeps up. I can even compile because i keep getting this error:

Microsoft (R) Macro Assembler Version 6.14.8444 Assembling: D:\masm32\JProject\ddraw\ex1.asm

Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

D:\masm32\JProject\ddraw\ex1.asm(293) : error A2006: undefined symbol
 coinvoke(16): Macro Called From
  D:\masm32\JProject\ddraw\ex1.asm(293): Main Line Code
Assembly Error
If i manipulate the parameters to 'wrong' symbols the assembler then tells you the parameter manipulated (suggesting all is well, but it stil wont compile.. gah!) Line 16 of Coinvoke is where Ernie has his concationatd string executed as an invoke.. (I see no problems there). I review my COM structures umpteen times and cant see a typo or anything, and beside, the compiler would have told me if it was.. (prooven by experiment..) If anyone with the expertise to see this crazy bug, i would be happy to hear from you... Thanx in advance.. NaN
Posted on 2001-05-04 00:23:00 by NaN
I'm not really that great with COM, but I've found many times that when MASM reports an error in a line, the error's sometimes in the lines above or under the line Masm reports. Not much help, but I remember going *whaaaaa* when masm reported "invalid opcode" in a line that was just a comment :rolleyes: Also, what about "invalid instruction operands" in a .endif :D. I'm actually not sure this is a ml.exe problem ,maybe with quickeditor. - Qweerdy
Posted on 2001-05-04 06:24:00 by Qweerdy
Thanx for the sugestion, but i have already been down those roads... :( Is a very elusive, and very specific problem.. i just can figure it out... I keep going over the include and comparing it to other compiling COM's i have done (MS AGENT) and nothing has changed... Its like the compiler just doesnt like me.. because the code reveals no reason otherwise... Very frustrated NaN
Posted on 2001-05-04 11:24:00 by NaN
Well Im surprised none of the guru's got to it..... I finally discovered the error. ( AND MAN IS IT EVER STUPID ).. I actually posted the error above. Anywho heres the stupid mistake that will leave no indication of its existance.
_vtIDirectDraw MACRO CastName:REQ &CastName&_QueryInterface IDirectDraw_QueryInterface ? &CastName&_AddRef IDirectDraw_AddRef ? &CastName&_Release IDirectDraw_Release ? ... ENDM
More specifically: &CastName&_WHATEVER IDirectDraw_WHATEVER ? When i cast it with the a name IDirectDraw (as i have been), the above becomes ambigous: IDirectDraw_WHATEVER IDirectDraw_WHATEVER ? And this causes the error with no discription when medling with com's. I can say however it was good learing, becuase i totaly teared through every com .inc i have and really strengthened my understanding of Ernie's methods. For instance, I had thought the _vt tables were set up to adhear to Ernie's style of com's, while true, i didnt fully realize that Ernie's coinvoke was nothing more than the lecture i gave on structures earlier with pointers. (Its soooo clear now :D ) so: coinvoke ppIT, IDunno, DoSomething is the same as: mov edx, ppIT mov edx, invoke (IDunno PTR ).IDunno_DoSomething, ppIT ...where IDunno is a structure of pointers to function PROTO's.. To be honest, i dont think i will continue with the COINVOKE, i find the above more readable... Anywho, there it is.. we can all get our rest now (hehehe) :D NaN
Posted on 2001-05-04 15:44:00 by NaN