CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2005
    Posts
    6

    Question Compiling C++ library for VB.Net

    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?

  2. #2

    Re: Compiling C++ library for VB.Net

    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...

  3. #3
    Join Date
    Jan 2005
    Posts
    6

    Re: Compiling C++ library for VB.Net

    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.

  4. #4

    Re: Compiling C++ library for VB.Net

    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 . . .

  5. #5
    Join Date
    Jun 2003
    Location
    Malaysia (P.J)
    Posts
    410

    Re: Compiling C++ library for VB.Net

    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...
    Back after a long hibernation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured