Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1113069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:48:03+00:00 2026-05-17T02:48:03+00:00

OK, so I have a C++ project that compiles to a DLL file. I

  • 0

OK, so I have a C++ project that compiles to a DLL file. I am able to reference this file in C# and see/use all of the objects and functions within the DLL file. What I need to do is to reference those objects and function through VB6.

The C++ code has nothing in it that looks like it’s creating a DLL. There are no ‘__declspec(dllexport)’ modifiers, just C++ code.

There are objects like this:

String ^
Array^

I’m not entirely sure what they are. My knowledge of C++ is not very extensive and I’ve only coded in C++ for Linux systems, although from the usage they sort of look like pointers. Do these objects have anything to do with a DLL in C++?

Anyway, I can add any wrappers that I need or add a definition file (.def), although I do not know what wrappers to use and I don’t know how a definition file works or how it needs to be constructed.

Any help and/or suggestions are appreciated. If you can refer me to some good info as well, that would be helpful. All searching I have done has not helped.

Remember, I need to access all functions and objects in this C++ DLL from VB6.

Thanks.

EDIT: Added .h file and AssemblyInfo.cpp spec to the question

I changed some names in these files, but the structure is the same. Note that this references other files, but I assume that if one can be made to work then the others can with the same process. I can see every object, just not the methods:

//myDBObject.h
#pragma once
using namespace System;
namespace myDBNamespace {

#include "ProblemSolution.h"

public ref class MyDataBaseAccessor
{
public:
    MyDataBaseAccessor();

    static  String ^    GetServiceVersion() { return sDLLVersion;};
    int                   GetServiceStatus() { return myiDBStatus;};
    String ^                GetMyVersion();
    String ^                GetDBVersion();
    String ^                GetDLLVersion();
    String ^                GetExpireDate();

    MyOtherObject ^         GetMyOtherObject();

    int             ProcessProblem(ProblemSolution ^ dsps);

private:
    static  MyDataBaseController ^  myDataBase;
    static  MyOtherObject ^         myObjs;
    static  MyDataset ^     myDS;
    static  String ^                myDBPath;

    static  String ^                sDLLVersion = "0.01";
    static  String ^                sReqDBVer = "0.01";
    static  int                     myiDBStatus;
    static  bool                    myBoolean, myOtherBoolean, mybNoChain;

};
}

Here is the AssemblyInfo.cpp file:

#include "stdafx.h"

using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;

//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("My Product Title")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("My Company")];
[assembly:AssemblyProductAttribute("My Product Name")];
[assembly:AssemblyCopyrightAttribute("My Copyright")];
[assembly:AssemblyTrademarkAttribute("My Program")];
[assembly:AssemblyCultureAttribute("")];

//
// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly:AssemblyVersionAttribute("1.0.*")];

[assembly:ComVisible(true)]; //Here is the ComVisible tag. It was false and I set it to true

[assembly:CLSCompliantAttribute(true)];

[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = false)];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:48:03+00:00Added an answer on May 17, 2026 at 2:48 am

    Use regasm to create a COM Type Library (.TLB) file from your C++/CLI assembly.

    You should now be able to reference the C++/CLI code by referencing the TLB file in your VB6 code. From the example there:

    In its simplest form, you can do:

    REGASM MyAssembly.dll

    Now, all of the
    COM-compatible classes are registered
    as COM objects. You can fire up VB6
    and start writing code:

    Dim net As Object
    
    Set obj = CreateObject("NETProject.Foo")
    obj.Move
    

    Pretty easy. Except that you’re late
    binding because you don’t have a COM
    type library.

    No problem! REGASM can generate a type
    library for you and even register it:

    REGASM MyAssembly.dll
    /tlb:MyAssembly.tlb

    Now, in VB6 you can add a reference to
    the type library and use early
    binding:

    Dim net As Foo
    
    Set obj = New NETProject.Foo
    obj.Move
    

    EDIT:
    Make the class COM visible like this:

    [ComVisible(true)]
    public ref class MyDataBaseAccessor
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project that compiles and runs fine on my development machine but
I have a game code (from ioquake3 project) that compiles part of gameplay binaries
I have a project that defines an idl and it compiles it using MIDL.
I'm using C# and VS2010. I have a dll that I reference in my
I have a project that needs to access a DLL with PHP. The server
Good Day I have a project that makes use of custom assemblies in the
I have been trying to add a .cu file into my own(dll) win32 project
I have a c++ Project that was compiled with the cygwin toolchain, now I
I have a DUnit project that won't compile as Console if I add some
We have a big C++ project that's compiled as native unmanaged code. We need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.