Hello Charles
How does a Freebasic exe program call an O2 dll ? can you show me how to do it?
how does a FB exe program can make use of O2 libraries functions ?
Thanxx
Hi Chris,
I have not done this for years! FreeBasic uses GCC to build its binaries, and GCC requires .a import files for DLL linkage.
For each DLL imported into FreeBasic, you have to write a .def file, listing all the DLL calls.
The call names have @n suffixes to indicate the number of bytes being passed
Then use dlltool.exe to build your .a file
It's like dancing in wellies. ;D
There is a complete example in the o2 package:
examples\UseRTL32\FBO2DLLTEST
This nasty business of import libraries is the thing that I more dislike from FreeBasic, to the point that I never use it. In my framework, I use LoadLibrary/FreeLibrary.
> There is a complete example in the o2 package:
> examples\UseRTL32\FBO2DLLTEST
Which does not cover the essential problem of working with strings. Beginners don't know that you can't simply use AS STRING and hope that it will work with any language. FreeBasic dynaminc ansi strings use a proprietary format that is incompatible with other languages.
Thanxx Charles
i will look into that code and figure out how to do it, FB 's dll is a much harder to do than O2 dll
O2 dll is so much simpler
Thanxx Jose, what would be best strings to use in another language if we are getting FB ansi strings from a FB dll ?
can we use WSTRING * 100 in FB ? that means allocate a fix length of 100 characters to be passed from FB dll
maybe i can add a null at the end of the string
@José sorry it seems you have got a chewin gum under your shoes :)
> can we use WSTRING * 100 in FB ? that means allocate a fix length of 100 characters to be passed from FB dll
maybe i can add a null at the end of the string.
Do you know what a WSTRING is? No, you don't. In FreeBasic, a WSTRING is a null terminated unicode string. Being null terminated means that you don't have to add a null and that WSTRING * 100 will have a capacity of 99 unicode characters and a double null terminator. In PowerBasic, a WSTRING is something different: A dynamic unicode OLE string.
You can use wathever you wish as long as the code that will use it is prepared to deal with the passed or returned data. And this is the problem: that you don't know how to write such code and we can teach you in five minutes what it has taken us years of learning.
Thanxx Jose
i will use WSTRING*101 without the null added as it is already terminated with a null character
good learning from you
So we have not put you off using FreeBasic yet, Chris :)
No Charles, not at all
we will be using a mixture of C#, O2 and FB to tackle our PB translation to 64bits.
as a matter of fact, O2 is much more better and flexible than FB which is strongly type.
the handling of strings by FB is very wierd, we would like to use O2 Bstring which is the best possible
to match PB strings !
whatever we can't translate to O2, we will try out on FB and whatever FB cannot do (such as GUI interface) we
will use C# . C# will form the front end only and all the backend computations and file handling by O2 and FB.
eventually, C# would be replaced by C++ when we are able to master it.
> and whatever FB cannot do (such as GUI interface)
Really? First notice. I wonder how Paul has managed to build his editor and how I have been able to write hundreds of examples that use a GUI.
https://www.freebasic.net/forum/viewtopic.php?t=23484 (https://www.freebasic.net/forum/viewtopic.php?t=23484)
please look at the replies by Pritchard
Sorry, I don`t have time to read all this. If you mean that the language has not native procedures to build a GUI, then I agree (neither C++ has them), but this doesn't mean that you can't build a GUI using the Windows API or other libraries.
That is a 3 year old post. FB has grown in 3 years.
There is nothing in PowerBasic that we can't do in FreeBasic with the possible exception of some esoteric COM stuff (that most PB'ers didn't use anyway).
GUI in FreeBasic is easy especially if you understand WinAPI. My FireFly Visual Designer has proved that, the new WinFBE proves that, all of Jose's WinFBX and CWindow examples prove that. And this is just on the Windows operating system side. There are many more examples of GUI in Linux including several popular cross platform libraries.
Don't be too quick to judge FB. Sure, it has shortcomings but until you learn how to use it properly you are simply over extending yourself by wanting to use C#, O2, FB, etc for your project conversion.