Click to See Complete Forum and Search --> : Compiling C++ library for VB.Net


Zubair Younas
February 14th, 2005, 02:17 AM
I have to take input from the PDA. The probelm is the vendor has provided C++ library files to the programmer. Can we compile these files for .Net and then use it? If yes, how?

asSiDeluxE!
February 15th, 2005, 05:00 AM
If the c++ library is a dll then use this (example for RAS-API but works for all dlls):

<DllImport("rasapi32.dll", CharSet:=CharSet.Auto)> _
Private Shared Function RasHangUp(ByVal lphRasConn As IntPtr) As Integer
End Function

Be aware of the fact that if your c++ functions have structs with fixed sizes,e.g. TCHAR etc., as parameters you have to use Marshaling for your VB Structs to be fixed size to...

Zubair Younas
February 16th, 2005, 01:55 AM
The file is a static C++ library i.e .lib file and I want to use its functions into a VB.Net application which only supports a dynamic link library i.e. a dll or a COM object i.e. an .ocx file. Problem is how to convert that static library into a dll or .ocx.

I hope you understand the problem in a better way now.

Regards,

Zubair Younas.

asSiDeluxE!
February 16th, 2005, 04:33 AM
Ok, I understand...

My C++ knowledge is a little bit afflicted. :(
Perhaps you better post in C++ Forum about how to get a dll from the .lib . . .

newvisva
February 20th, 2005, 07:05 PM
Ur static VC++ dll can be converted into dynamic dll... U will hv to do that in VC++. There's an option where u can change from static to dynamic... After that u can use dllimport like asSiDeluxE! has mentioned...