C++ code in VB.NET / VB.NET straight code

sean_mackrory

Newcomer
Joined
Dec 30, 2003
Messages
1
I'm working on my own version of MacroMedia Flash MX. All the code for the File format is in C++ (just headers and code, no libraries), and everything else like the GUI, etc... is in VB.NET. How can I integrate the two so that my VB.NET GUI can access the functions of the C++ code. I'm thinking DLL, but once I have the DLL, how do I call those functions from within my VB.NET code?

I also don't want to spend $2000 getting Visual Studio, so I'm using MicroSoft's .NET SDK, which is all command-line compilers. Now I'm OK to do almost all the coding by hand, but how do I specify other things like the project file and the entry point of the program? Or does the SDK have a feature for doing that?

Thanks a lot,
Sean Mackrory
 
You use your AssemblyInfo.vb file to specify the project title, since you're working from the command line you probably haven't got one, it looks like this:
Visual Basic:
Imports System.Reflection
Imports System.Runtime.InteropServices

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

' Review the values of the assembly attributes

<Assembly: AssemblyTitle("")> 
<Assembly: AssemblyDescription("")> 
<Assembly: AssemblyCompany("")> 
<Assembly: AssemblyProduct("")> 
<Assembly: AssemblyCopyright("")> 
<Assembly: AssemblyTrademark("")> 
<Assembly: CLSCompliant(True)> 

'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("Add a GUID here")> 

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

<Assembly: AssemblyVersion("1.0.*")>
To integrate with a DLL, what DLL type is it? Win32 or Managed C++?

If it's Win32:
Visual Basic:
Public Class MyClass
      Private Declare Function MyCFunction Lib "MyCDLL.dll" (MyParam As String) As Integer
Managed programs do not have "EntryPoints" like C++, you can create a Public Shared Sub Main() which acts like an EntryPoint but you can also specify to just start the form, I don't know how to do this from the command line though.

You don't need to spend $2000 on VS.Net because you can buy the individual langauges, so you can get just Managed C++ or just VB.Net, they only come in Standard Editions though, you won't have the advanced features. VS.Net Purchase Options
 
Back
Top