Access VB Managed DLL from un-managed Code of VC
Hi
I have a managed DLL (class library) made in VB .NET 2003. I have to use the
DLL in VC .NET 2003. My VC code is un-managed.
How can I make the above work???
I created a simple windows console application to test my dll.
In my VC project, I created an object of the class in VB DLL, it gives me
ERROR that the
1. object can't be destroyed...
2. 'VBClassLibrary::TestClass' : illegal use of managed type
'VBClassLibrary::TestClass'; did you forget a '*'?
I am not concerned about manage/un-managed code..
=MY DLL
Code======================================================================
Public Class TestClass
' Define a local variable to store the property value.
Private allowSum As Boolean
' Define Add function which adds two double values and retunes the
' sum of two
Public Function Add(ByVal val1 As Double, ByVal val2 As Double) As Double
If allowSum = True Then
' Return the sum of two input values
Return val1 + val2
Else
Return 0
End If
End Function
' Define AllowAddition property
Public Property AllowAddition() As String
Get
Return allowSum
End Get
Set(ByVal Value As String)
allowSum = Value
End Set
End Property
Protected Overrides Sub Finalize()
End Sub
End Class
==================================================================================
==My VC code===(its an console
Project)====================================================
#include "stdafx.h"
#using <mscorlib.dll>
int _tmain()
{
VBClassLibrary::TestClass ads;
return 0;
}
==================================================================================
moreove you can access my whole code at http://www.ashutosh.info/code.zip
Regards,
Ashutosh