Thread: Using VB-dll with C

  1. #1
    Registered User
    Join Date
    Nov 2005

    Using VB-dll with C

    I have a dll written in VB and would like to load it and use it from C code. How do I do that? Are there any type differences that I need to handel, that is the Strings are different etc.

    I have some example code in VB that starts like this:

    Private Declare Function fcInit Lib "FooBarApi.dll" () As Long
    Private Declare Function fcSearchFooBar Lib "FooBarApi.dll" (ByVal xmlBefRecord As String, ByRef xmlLength As Long, ByVal nMode As Long) As Long
    Private Declare Function fcDeleteFooBar Lib "FooBarApi.dll" (ByVal xmlBefRecord As String) As Long
    Private Declare Function fcDeInit Lib "FooBarApi.dll" () As Long

    It uses COM+.


  2. #2
    train spotter
    Join Date
    Aug 2001
    near a computer
    Look at COM+ or .NET to link the two (VB and C)

    I have used DCOM/COM+ for C++ -> VB and VB -> C++

    Remember data passed will have varing limits (VB int != C int) and most likely be converted into VARIANTs or BSTR strings.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DLL Error with VB .NET Program
    By willc0de4food in forum Windows Programming
    Replies: 6
    Last Post: 04-09-2005, 02:38 PM
  2. Passing an Array of Strings from VB to a C DLL
    By mr_nice! in forum Windows Programming
    Replies: 9
    Last Post: 03-08-2005, 06:16 AM
  3. Calling a VB DLL w/ forms from C++ DLL
    By UW_COOP in forum C++ Programming
    Replies: 8
    Last Post: 06-30-2003, 08:04 AM
  4. Accessing varibles in a DLL from VB in run-time.
    By Dirty Sanchez in forum Windows Programming
    Replies: 1
    Last Post: 04-27-2003, 11:25 AM
  5. Passing parameters from VB to C++ through ActiveX DLL
    By torbjorn in forum Windows Programming
    Replies: 0
    Last Post: 12-10-2002, 03:13 AM