Prrrrrleeeeaaaaseeee?????

Cableguy

Expert
Licensed User
Longtime User
Erel, Could you please post a sample wrapper source-code?
 

Cableguy

Expert
Licensed User
Longtime User
the scrool bar uses known namespaces and therefore are (now) straight foward to implement..
I just can figure out how to "call" an outside dll and "refer" to it to build a wrapper...
 

Cableguy

Expert
Licensed User
Longtime User
I "wish" to wrapp the two libraries I found and posted inthe "wishList" forum!!

Maybe head over feet but Im willing....
 

agraham

Expert
Licensed User
Longtime User
You declare the entry points in the non.NET dll as follows

B4X:
    // for C#
    [DllImport("User32.dll")]
    public static extern int MessageBox(int h, string m, string c, int type);

    ' for VB
Declare Auto Function MBox Lib "user32.dll" Alias "MessageBox" ( _
    ByVal hWnd As Integer, _
    ByVal txt As String, _
    ByVal caption As String, _
    ByVal Typ As Integer) _
    As Integer

    ' also for VB
  <DllImport("User32.dll")>
Public Shared Function MBox Lib "user32.dll" Alias "MessageBox" ( _
    ByVal hWnd As Integer, _
    ByVal txt As String, _
    ByVal caption As String, _
    ByVal Typ As Integer) _
    As Integer

Then use them as normal methods, a bit of documentation from VS 2005 attached.

EDIT: Open the doc in Wordpad - despite telling it to save it as txt it seems to be rtf!
 

Attachments

  • dllimport.txt
    3.6 KB · Views: 236
Last edited:

dzt

Active Member
Licensed User
Hi all,

1. Access to native DLLs (native DLL is a DLL compiled to machine code) can't be accieved from B4PPC directly (now and in the future).

The reason is that there is no way to do that trough C# (The .NET language behind B4PPC) at runtime. And C# runtime (I repeat, runtime not design time) limits are the upper limits of B4PPC by it's nature.

Therefor a NET wrapper is always needed.

2. Access to .NET DLLs theoritically could be done trough B4PPC directly (without a wrapper) if B4PPC could have support for every data type supported by C#.NET. For now B4PPC have serious limitations on this.

So a wrapper is needed to convert complex .NET data types to well known B4PPC data types.
 

dzt

Active Member
Licensed User
the scrool bar uses known namespaces and therefore are (now) straight foward to implement..
I just can figure out how to "call" an outside dll and "refer" to it to build a wrapper...

To refer to a .NET DLL from SharpDevelop to "Projects" panel, right click "references", click ".NET Assembly Browser" tab, click "Browse" button and select your .NET DLL.

Now its elements are accessible from your code.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
2. Access to .NET DLLs theoritically could be done trough B4PPC directly (without a wrapper) if B4PPC could have support for every data type supported by C#.NET. For now B4PPC have serious limitations on this.
It is more accurately to say that Basic4ppc doesn't support custom data types. It does support all primitive data types (including Object data type).
 

agraham

Expert
Licensed User
Longtime User
Last edited:

dzt

Active Member
Licensed User

Cableguy

Expert
Licensed User
Longtime User
The GemBox component is a .Net component.
You should try adding the dll to Basic4ppc directly.
If the dll includes methods not supported by Basic4ppc you should create a .Net project, add a reference to this dll and create the required methods and properties.
It will only work on the desktop as this is not a .Net CF dll.

I tryed it already and it does add a lot of object but error because there's a few objects bettween classes that are named the same....
Also none of the available objects seem to be "callable"....
 
Top