Skip to Content
avatar image
Former Member

Working with COM in PB

Hello All,

I have created a COM wrapper dll for a webservice using C# which I want to call from PB (12.5.2 5609). My problem is that PB does not release the object after code has executed. Any ideas what am I doing wrong?

Here is my pb code:

Integer Rtn

OleObject oWS

oWS = CREATE OLEObject

Rtn = oWS.ConnectToNewObject ("myWS.class1") // Returns 0 = Success

Rtn = oWS.ProcessA () // Returns success

Rtn = oWS.DisconnectObject () // Returns 0 = Success

DESTROY oWS

The DisconnectObject returns 0 but the object is still in memory.

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 31, 2016 at 07:03 AM

    I use ConnectToNewObject and DisconnectObject followed by a Destroy. However I have noticed that if I am running my application from the PB IDE it keeps the dll in memory, so I can't replace the dll with a new one until I exit from the IDE, whereas this isn't as issue on a built application.

    Also, my ,NET cCOM wrapper objects are either registered in the registry or I uses side-by-side dlls with manifest files. Not sure how you are accessing yours?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 30, 2016 at 10:21 PM

    Does ConnectToObject ( ) work? Rather than connect to new. I seem to recall something from five years ago...

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 31, 2016 at 06:01 AM

    I usally use:

    lole_X.DisconnectObject()

    destroy lole_X

    GarbageCollect()

    Bernhard

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 31, 2016 at 09:09 AM

    If it is COM collable wrapper class then you have to bind the dll using RegAsm, After bind the dll you can use the dll using Ole client.

    Thanks

    Avishek

    Add comment
    10|10000 characters needed characters exceeded