Connecting Tech Pros Worldwide Help | Site Map

VC ++6 dll reference in vb.net Project

Newbie
 
Join Date: Aug 2009
Posts: 4
#1: Aug 7 '09
I have a dll of vc++6 . it have some mathod and function. so i want to use this dll in vb.net . when i reference this dll i have got an error .like dll is not valid assembly or COM component. plz help me it is urgent
Newbie
 
Join Date: Aug 2009
Posts: 4
#2: Aug 8 '09

re: VC ++6 dll reference in vb.net Project


PLZ any body tell me how to reference vc++6 dll in vb.net .when i reference this dll i got an error like it is not vaild assembly or COM component.
plz Help me it is too urgent to me . thank u
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#3: Aug 14 '09

re: VC ++6 dll reference in vb.net Project


You have to register the DLL using the regsvr32 tool.

This registers the DLL (in the registry) so that other programs (your program is an "other program") can locate and use it.

Once you've done this you can add a reference to it in your project.

When you reference a COM Object, visual studio will automatically create an Interop DLL that will let your .NET code use the C++ code.

You should really research .NET interop and marshalling before you use a C++ class library (or any other unmanaged code) in your .NET code so that you understand the problems that you may run into.
Newbie
 
Join Date: Aug 2009
Posts: 4
#4: Aug 17 '09

re: VC ++6 dll reference in vb.net Project


Hi Frinavale
thank u for suggestion but when i register this dll . it need an entry point.
there is an error like " C:/pcscDll. was loaded,but the DllRegisterServer entry pont was not found.

def file is

LIBRARY pcscDll
EXPORTS
GenerateCryptogram;
ExecuteAPDU ;
GetReadersNames;
CardConnect ;
EstablishContext;
ReleaseContext;
CardDisConnect;
RemoveSpacesFromString;
GetATR;
iSCardIntheReader;

so plz help
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#5: Aug 17 '09

re: VC ++6 dll reference in vb.net Project


The DLL has to have an entry point in order to be registered.
This means that you have to have public code in the class library. There should be public classes/methods/structures etc

If there isn't then you'll see this error.

You'll also sometimes see this error if you are using the -i switch.
(eg you'll see the error if you type: "regsvr32 -i C:/pcscDll.dll")

If you remove this switch it may fix the problem
(just type: "regsvr32 C:/pcscDll.dll")
Reply