net interface tutorial.


Net interface together with dll tool allows you to use darkbasic commands in your .net third party command dlls.

Start a new dll project in your ide of choice, for details see the dll_tool documentation

Net_tool uses dll_tool to export a function called Do_It so create the Do_It function.
C# code
using System;
public class MyClass
{
	public static void Do_It()
	{
		//
	}
}

Vb.net code
Imports System

Public Class MyClass
	Public Shared Sub Do_It()
		REM
	End Sub
End Class 
Net_tool requires dll_Tool v0.11 or later so check your version of dll_tool is new enough.

Select required dlls

Start net_int and select the dlls you wish to use the functions of.
To work out which dlls you need to export click the build button in the search groupbox. This gets a list of commands from the dlls string tables.
Now enter the commands you need in the search box and select the dlls that contain them.

We are just going to make a simple pong game so only need a few dlls, select the following dlls
DbProCore.dll
DbproBasic2dDebug.dll
DbproImageDebug.dll
DbProInputDebug.dll
DbProSpritesDebug.dll
Leave the namspace blank and enter a class name of "DbPro". Choose the language that you are using, click the build button and save in
the project directory.

Add the source file produced by net_int to your dll project and build the project.
Due to differences between how dbpro and c# handle function overloads and some other issues the files produced by net_int often need
some editing before they will compile. Basically just delete all the lines that give errors. Eventually net_int will be
hopefully not export code that will produce errors.

Before we start writing code we need to do some preperation work for int_tool.
In the dbProExe directory there is a dbpro project and a dll. Move the net_int.dll file to [Dbpro]\Compiler\plugins-user\
Open the dbpro project and compile it. net_int is just a dll with a Do_It method.
The dbpro exe just calls this method then exits. There is also an uncalled function with a list of commands, these commands are
needed to trick dbpro into compiling any dlls needed by our dll into the exe.

Start net_tool. Click the "Dll_tool location" button and navigate to dll_tool.exe. Click the "Dbpro exe location" and
navigate to the exe we compiled in the previous step.
Click the ".Net dll location" button and navigate to the location where your .net dll is built.
You can also change the display settings the exe will have and alter the interval to change how often net_tool will check the .net dll location.

net_tool

Now we are ready to write the dll. Click the "Go" button.
Enter this code into your dll project and click the build button.
c#
using System;
public class MyClass
{
	public static void Do_It()
	{
		System.Windows.Forms.MessageBox.Show("hello world");
	}
}
vb.Net
Imports System
Public Class MyClass
	Public Shared Sub Do_It()
		System.Windows.Forms.MessageBox.Show("hello world")
	End Sub
End Class
After a few seconds you should see this.


To speed the whole process up you can open the dbpro exe project and comment out any dlls you are not using.
This will keep the exe as small as possible. Since net_tool copies the exe and exchanges the dll the smaller the exe
the faster the program will be run after building your dll.

This is not yet complete, please check back later.