• Welcome to Theos PowerBasic Museum 2017.

#COM TLIB not working but no error

Started by Paul Breen, October 06, 2008, 03:50:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Paul Breen

I have been playing with the com stuff and tried to publish a tiny com object but there is no tlib in the exe even though "#com tlib on" runs with no errors. Why can't the com browser see the type library? (in the exe). There appears to be no information on #com tlib other than this string "#COM TLIB ON specifies that the compiler should create a type library for the compiled EXE or DLL." The debugger just ignores the com code when you step in. thanks.


#COMPILER PBWIN 9
#COMPILE EXE
#DIM ALL
'begin changes
#COM DOC "This is specific information to be used in the Help String"
'#COM HELP "MyProg.chm", &H1E00
#COM NAME "myLibName", 3.32
#COM GUID GUID$("{96CB271C-2435-4AC6-8511-886FD4807F47}")
#COM TLIB ON 'ON|OFF
'end changes

    $MyClassGuid = GUID$("{00000099-0000-0000-0000-000000000008}")
    $MyIfaceGuid = GUID$("{00000099-0000-0000-0000-000000000009}")

CLASS MyClass $MyClassGuid AS COM
  INTERFACE myInterface $MyIfaceGuid
    INHERIT IAutomation
    METHOD Method1(parm AS LONG)
      CALL abc(parm)
    END METHOD
  END INTERFACE
END CLASS

FUNCTION PBMAIN () AS LONG

        DIM objVar AS myInterface
        LET objvar = CLASS "myClass" 'must be double-quoted
        CALL objvar.Method1(44)

END FUNCTION
'--------
SUB abc(parm AS LONG)
    DIM strParm AS STRING
    strParm = STR$(parm)
    MSGBOX "sub abc called by MyClass Method1 with parm = " + strParm
END SUB 'abc


José Roca

 
Currently, PB only supports the creation of in-process servers (DLLs), not out-process servers (EXEs), so you must change #COMPILE EXE to #COMPILE DLL and remove PBMAIN.