Sharp develop tutorial.
|
Sharp develop is a free and opensource c# and vb.net ide
|
Create a new project by selecting File > New > New Combine from the menu.
Select either c# or vb.net as the categorie and class library as the template. Enter maths as the name and click create. |
Methods that you want to export should be public static in c# and public shared in vb.net.
We will export two methods add and subtract. c# code using System; namespace maths { public class MyClass { public static int add(int a, int b) { return a + b; } public static int subtract(int a, int b) { return a - b; } } } vb.net code Imports System Namespace maths Public Class MyClass Public Shared Function add(ByVal a As Integer, ByVal b As Integer) As Integer Return a + b End Function Public Shared Function subtract(ByVal a As Integer, ByVal b As Integer) As Integer Return a - b End Function End Class End Namespace |
Change the build type to release and click the build button to compile the dll.
You can find the dll in the projects bin\release directory. |
Start dll_tool and load the dll. The methods in the dll that can be exported are shown in the left hand methods list.
You can see the add and subtract methods we wrote there. |
Dbpro tpc(third party command) dlls use Cdecl as the calling convention so leave "the Moved methods will be"
combo box as Cdecl.
Select both the add and subtract methods and click the > button to move them to the exports list. Double clicking an item in the exports list will show a dialog that allows you to edit the export name and calling convention. Check the "Add string table" checkbox. Dbpro uses the dll string table to find out about the commands contained within the dll. Click the Generate button and the program will automatically produce a correct string table. You can edit a string table item by double clicking it. Documentation on the string table can be found in the technical documents > third party commands section of the dbpro help. The dll is now ready to be build so click the build button to build it. If you are going to be working on the dll in the future you can save a .dsf (dll tool settings file) to make it less work. A dsf file contains the filename of the dll and a list of exports and any string table items. After you have made changes to the dll load the dsf file. The dll in the dsf file will automatically be loaded and any methods that match the exports in the dsf file will be moved to the export list and the string table items added to the string table list. |
The built dll can now be moved to the Dbpro\Compiler\Plugins-user directory and the commands used in dbpro.
dbpro code a as integer b as integer c as integer a = 50 b = 100 c = add(a,b) print c c = subtract(a,b) print c wait key |