VB app crashes when using COM DLLs 
Author Message
 VB app crashes when using COM DLLs

Hi there!

I have a problem with COM objects I have created in C++ when using them
in VB. What happens is that VB crashes when my VB app exits.

The only thing I have to do for this to happen is:

Private Sub Command2_Click()
    Dim test As Object
    Set test = CreateObject("Excosoft.Test")
End Sub

I can use the object and everything seems to work fine, the only
problem seems to be when the app is exiting.

What happens during exit is that my DLL's DllCanUnloadNow()

function is called and I return true since there are no more
living objects in the DLL. The DLL is then unloaded by COM.
And then VB crashes...

VB does not crash if DllCanUnloadNow() returns false, but then
my DLL is not unloaded, obviously.

So it seems that VB wants something from DLL after it has unloaded,
but I have no idea as to what that might be. There are no living
objects and I would have thought that that was the only reference
VB has to my DLL.

Anyone got any ideas?

Cheers,
Emil

--
===========================================================
  Emil Astrom, programmer, Excosoft AB

  http://www.*-*-*.com/    
===========================================================



Sun, 31 Aug 2003 16:27:27 GMT  
 VB app crashes when using COM DLLs
In case anyone wonders, I found the problem. I called CoUninitialize()
during the unloading of my component. Not a great idea...

/Emil

Quote:

> Hi there!

> I have a problem with COM objects I have created in C++ when using them
> in VB. What happens is that VB crashes when my VB app exits.

> The only thing I have to do for this to happen is:

> Private Sub Command2_Click()
>     Dim test As Object
>     Set test = CreateObject("Excosoft.Test")
> End Sub

> I can use the object and everything seems to work fine, the only
> problem seems to be when the app is exiting.

> What happens during exit is that my DLL's DllCanUnloadNow()

> function is called and I return true since there are no more
> living objects in the DLL. The DLL is then unloaded by COM.
> And then VB crashes...

> VB does not crash if DllCanUnloadNow() returns false, but then
> my DLL is not unloaded, obviously.

> So it seems that VB wants something from DLL after it has unloaded,
> but I have no idea as to what that might be. There are no living
> objects and I would have thought that that was the only reference
> VB has to my DLL.

> Anyone got any ideas?

> Cheers,
> Emil

--
===========================================================
  Emil Astrom, programmer, Excosoft AB

  http://www.excosoft.se    
===========================================================


Tue, 02 Sep 2003 21:06:13 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing structures from C++ app to a VB client app through Network connection using COM

2. VB using COM crashed in IDE, exe is fine

3. VB 4 16 App crashes oc25.dll on win31

4. C++ Win32 DLL causes VB DX app to crash

5. Crashed when using sqldmo.dll in VB.Net Beta 2 SR1

6. vb crashes when closing -using Dll -help please

7. Call VB DLL or COM object from within VB COM object or EXE

8. VB6 IDE crashes when reference local DLL that uses a remote MTS DLL

9. Having VB list all the DLLs used by that same VB app

10. Register a com dll using VB.Net code

11. howto: using a COM.dll within VB

12. Random Crashes Using Com in IE

 

 
Powered by phpBB® Forum Software