There are two major projects in the LINUX environment that try to implement
.NET integration. This is the DotGNU project hosted on www.dotgnu.org and the Mono project hosted
on www.go-mono.com. Currently .NET integration
could only be used with the DotGNU Portable.NET software distributed by the
DotGNU project. The reason is that the C-sourcecode of this project makes
it much simpler to integrate the software with HBasic than the self-hosting
compiler of the Mono project.
Integrate .NET support for HBasic therefore requires two steps of preparation
and two steps to integrate into your project.
After you have finished this installation steps you can insert the .NET
integration into your project in the project options dialog and insert NET
libraries into your project.
Download C# Compiler and PNET library files from www.dotgnu.org. This normally
requires
pnet.*.tar.gz - Runtime engine, C# compiler, and
other tools
pnetlib.*.tar.gz - pnetlib C# library
treecc.*.tar.gz - treecc build tool
Compile and install this files on your computer in whatever directory you
like. This normally requires to
unpack the files with tar -xzvf filename
cd filename-directory
run ./configure, make and make install in the
source package directory
Have a look at the installation instructions of this packages or at the
page of southern-storm
if you get problems with this short description.
2) Compile and install the HBasic .NET integration
library
HBasic uses a special dynamic library to integrate the NET functions into
the HBasic program. This library will be compiled and installed if you run
make net in the HBasic source directory. You can find the sourcecode
and Makefile for the net integration in the net_support subdirectory
of your HBasic distribution.
Before you can compile this library correctly you have to insert the path
of the directory where you have unpacked and compiled the pnet-* files into
the Makefile in the net_support directory. In the first lines of this Makefile
is an entry like
PNETDIR=/usr/src/pnet-<version-number>
Replace this with your installation path of the pnet-package.
PNETDIR=<your installation path of pnet files>
HBasic needs this to read the includefiles and libraries of the DotGNU software
which will be used in the DotGNU integration library.
The generated library will be called net_support.hbso and will be placed
in the /usr/local/hbasic/lib directory. If you want to integrate .NET support
into the current HBasic project HBasic will start loading this library.
If you didn't compile the DotGNU library before you compiled HBasic this
integration library will not be created and you therefore cannot load NET
integration from HBasic. If you want to add .NET support later rerun make
and make install for HBasic to create this library.
3) Insert .NET support into your current HBasic
project.
After you have compiled and installed the libraries required for .NET integration
you have to select in your current project if you want to use this functions
or not. The .NET integration library will not be loaded on default because
it requires some memory ressources and takes some time to load on every start.
To use .NET integration in your current project you have to activate it
in the project options.
Open the project options dialog with a click of the right mousebutton
on the project entry in the project tree.
Click on the Project Options entry to open the project options dialog.
Click on the Include Dot-GNU functions Checkbox
This project options will be stored in the project file if you save your
current project. If you reload this project description HBasic will automatically
try to load this Dot-GNU integration library again.
4) Include .NET libraries for your current project
If you compile a C# program or try to use classes that will be distributed
with the DotGNU project (like mscorlib.dll) this class descriptions and the
generated code will be distributed in library files. You have to include this
files into yout HBasic project like normal HBasic packages. To use for example
the class System.Console from the file mscorlib.dll in yout project execute
the following steps.
Find *.dll files in pnet directory and copy to /usr/local/hbasic/packages
Start package editor and click on Add package button
Select File type = "Net lib (*.dll)" to display files with extension
.dll
Select the library file that you want to use
After loading the library file the classes of the library file will be displayed.
You can get some more information about methods, properties... of the library
in the package editor.
You can find a C# class definition
that will be used with some .NET example programs in the code_examples directory
of your HBasic distribution.