Converting DLL to Gambas Libary
Posted
#1
(In Topic #669)
Enthusiast

I hope someone could advice me on this issue.
I have a DLL that has been custom wrote for me to provide promotional support to my Point of sale system (I paid for this to be created)
I have spoken to the company that did this DLL and they can not and will not convert it for use with Gambas. (as they use FreeBASIC in Linux)
Is is possible to convert a DLL to become a Library File for Gambas? ( I am happy to pay a small amount for someone to do this if it is possible)
Posted
Guru

/howto/extern - Gambas Documentation
Not my area of expertise I'm afraid, Steve and Voutt are masters of this kind of thing.
As long as you have the function names/parameters details it "should" be not too complicated.
Posted
Guru

If you have paid for it i'd ask for the source.
you may be able to re-write/convert it by hand
or if the dll is not useable then get the FreeBasic version of the library
Posted
Regular

Generally in Gambas external functions of a shared library (<COLOR color="#800000">.so</COLOR>), no DLL, can be called.
Such external libraries must be written in C language. In Gambas it is also possible to use external ".so" libraries, written in C ++, but their use is much more complex.
A conversion from the DLL library source can have two answers in my opinion:
- patiently :? convert each resource (and therefore the code contained in any external functions) of the DLL library into Gambas language (…this is not always possible);
- convert the library from "Dynamic Library " DLL into "Shared Library " .SO, so that then the external functions are called with the keyword "Extern " in your Gambas program.
Anyway, could you show us the source code of your dynamic library .DLL ?
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Enthusiast

BruceSteers said
Can you get the source code?
If you have paid for it i'd ask for the source.
you may be able to re-write/convert it by hand
or if the dll is not useable then get the FreeBasic version of the library
I have the source code it was written in Visual studios 2019
Posted
Enthusiast

vuott said
If you have and want to use an external library, it means that you intend to use the functions and other resources contained in that library.
Generally in Gambas external functions of a shared library (<COLOR color="#800000">.so</COLOR>), no DLL, can be called.
Such external libraries must be written in C language. In Gambas it is also possible to use external ".so" libraries, written in C ++, but their use is much more complex.
A conversion from the DLL library source can have two answers in my opinion:
- patiently :? convert each resource (and therefore the code contained in any external functions) of the DLL library into Gambas language (…this is not always possible);
- convert the library from "Dynamic Library " DLL into "Shared Library " .SO, so that then the external functions are called with the keyword "Extern " in your Gambas program.
Anyway, could you show us the source code of your dynamic library .DLL ?
I can show you a snipe as for some reason the compnay did the DLL in seperate functions
Code
Imports System.Xml
Public Class _
AnyOfDiscountProduct
Inherits DiscountProduct
Public Overrides Function _
Accepts(
anItem As MultisaverDiscountItem) _
As Boolean
Return (
_barCodes.Contains(anItem.Item.Product.BarCode) AndAlso
Not Filtered(anItem))
End Function
Public Overrides Function _
FromXml(
aNode As XmlNode,
aSupportedFilters As FilterFactory) _
As DiscountProduct
MyBase.FromXml(aNode, aSupportedFilters)
For _
Each child As XmlNode _
In aNode.ChildNodes
If (child.Name.ToLower() = "barcode") Then
_barCodes.Add(child.InnerText.Trim())
End If
Next
Return (Me)
End Function
Private _
_barCodes As New List(Of String)
End Class
The DLL handles the promotions like
buy one get one free or any 6 get 10% off the total lot
The VB app would send to the module every item that is scanned and when the total key is pressed I would get a result of all offers that
was processed.
I have tired in the past to support the offers etc with in my app and code them myself but I could never get it to work and this DLL handles
them perfectly
Posted
Regular

It also seems to me that there are references to other functions or in any case to other resources external to that your posted code.
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Regular

Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Enthusiast

Yes the code I sent is a veriest of BASIC (Visual BASIC) As all of my EPoS systems are Done in Visual basic (visual studio 2008 for my part) I am very up on VB but I am still getting my head around Gambasvuott said
I do not know Visual studios 2019 language, but it seems to me a Basic dialect. Most likely it could be translated directly into Gambas.
It also seems to me that there are references to other functions or in any case to other resources external to that your posted code.
From what I can see the code is not using any Windows only API the only thing it is importing is a XML framework as that is the format the data comes from the back office system (as that was what the other company requested I output to them in)
vuott said
Sorry, have you ever thought about writing a Gambas code yourself, to solve that problem ?
I would love to write it myself but I never managed to get it to work in VB ever (that is why I had to pay another software company to create the DLL for me in the first place.)
Posted
Regular

Otherwise someone who knows the Visual basic / Visual studio for conversion should step in to help you here.
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
1 guest and 0 members have just viewed this.


