In almost every basic dialiect that alows access to external dlls and libs, when calling those libs you simply use a DECLARE statement to declare the function and its arguments, and then use the command like any other command in the language.
In PureBasic you are forced to use multiple functions to load the libs LoadLib(), and IsFunction() and CallFunction() etc... rather than what most languages do, which allow declare statements and then the functions declared become accessable seamless, just like any other function in your program.
This would be a very helpfull addition and make porting from other basic dialects (most that support this like VisualBasic and PowerBasic) ALOT easier, this coming from someone in the proccess of porting a 4 year project from both those languages into PureBasic.
(Implemented as 'Import/EndImport')
[Implemented] DECLARE statement
-
- User
- Posts: 77
- Joined: Sun Nov 02, 2003 1:47 pm
- Location: Washington
- Contact:
[Implemented] DECLARE statement
AMD 2600+, nVidia Geforce FX 5200 128 MB DDR, 512 DDR, RedHat 9
In PB, you can use dll's as if they where pb commands, take a look at the ddl importer in te library sdk.
Code: Select all
--------------------------------------------------------------------
PureBasic DLL Importer - v3.60
(c) 2003 - Fantaisie Software
--------------------------------------------------------------------
Introduction
------------
PureBasic allows to uses external DLL as it was standard commands, with an
trailing underscore (ie: SendMessage_(), CreateWindowEx_()...). Almost
all the Win32 API is natively supported by PureBasic, and with this
tool, it's now possible to add your own dll or update the actual one.
I. Building a DLL Definition file
---------------------------------
The DLL Definition file is a list of all the DLL functions you want to support
in PureBasic. It's plain ASCII and use a very easy format:
DLLNAME.DLL
Function1 NbParameters
Function2 NbParameters
Function3 NbParameters
...
Comments are accepted, using the ';' character.
Example (which works with the DLLSample.pb example):
; PureBasic DLL import file
;
PUREBASIC.DLL
EasyRequester 1
Once the file is finished, just save it with the .pbl (PureBasic Library) extension.
II. Using DLL Importer with the GUI
-----------------------------------
1) Selects the 'PureLibraries' directory. It's located in the PureBasic
drawer and should contains a 'Windows' directory, inside
which it should have a Bin\BuildLib.exe tool. This tool is needed
to make the DLL, and it's used internally by the DLL Importer. You don't
need to use it.
2) Select the 'PureDLL' drawer. Just create a new drawer and choose it. A drawer
called 'Exports' will be created automatically if none are found.
Note: When the program quits, these settings are automatically saved.
3) Now, you can select the .pbl file by clicking on 'Start'. If you have lots
of files to import, you can check the 'Process whole directory' checkbox and the
all the .pbl files found in the 'PureDLL' drawer will be imported.
If have any questions, remarks, suggestions, just write to:
support@purebasic.com
-
- User
- Posts: 77
- Joined: Sun Nov 02, 2003 1:47 pm
- Location: Washington
- Contact:
You misunderstand, and everytime I post a request I get the same answers, it doesnt matter if there are OTHER ways to do something, hell every single request in this part of the forums has "some other way" to accomplish the same goal. Its about making an easier, more userfriendly method.
Now if you just allowed the dll definition files to be used INSIDE of the source code files, that might be enough.
(or does it allow you to use that as part of the code?) We are speaking about linux mainly because I do not develop in windows.
And is there a way to include them within the CompilerSelect so certain libs load with certain OS's? for instance OpenGL32.Dll is the windows name, but libGL.so is the linux name.
Now if you just allowed the dll definition files to be used INSIDE of the source code files, that might be enough.

And is there a way to include them within the CompilerSelect so certain libs load with certain OS's? for instance OpenGL32.Dll is the windows name, but libGL.so is the linux name.
AMD 2600+, nVidia Geforce FX 5200 128 MB DDR, 512 DDR, RedHat 9
If there are OTHER ways, this means it's already possible, why make a VB clone of Purebasic?Akuma no Houkon wrote:You misunderstand, and everytime I post a request I get the same answers, it doesnt matter if there are OTHER ways to do something, hell every single request in this part of the forums has "some other way" to accomplish the same goal. Its about making an easier, more userfriendly method.
It's not the goal of Fred to make Purebasic look like all other basic's out there.
I personaly left the past behind (GFA), forget about all the basic's i used before, and in 6 weeks i coded in PB without problems.
I got some problems with the syntax the first weeks, but if a look back now, all those things are actualy easyer to do in Purebasic.
mmm, i did not know about "VisualBasic and PowerBasic" on LinuxAkuma no Houkon wrote: We are speaking about linux mainly because I do not develop in windows.

maybe you better post all your questions in the linux forum.
or start all your subject lines with "Linux:"
-
- User
- Posts: 77
- Joined: Sun Nov 02, 2003 1:47 pm
- Location: Washington
- Contact:
Why do you think I do not use them anymore? The only reason I choose a language still in its infantcy like this is because they do not have linux versions and this one does.mmm, i did not know about "VisualBasic and PowerBasic" on Linux
maybe you better post all your questions in the linux forum.
or start all your subject lines with "Linux:"
I could say the same for every feature that is on the feature request list. Hell if you were good enough, you could just skip every function that Fred has added and just use pure inline asm to accomplish your goals. Hell you could even skip PureBasic and compile directly in FASM. The purpose of other languages like this is to create functions that simplify the development proccess while allowing maximum flexiblity.if there are OTHER ways, this means it's already possible
Just because another language has a feature does not mean you cannot have it as well. Exspecially if you want to appeal to those programmers who enjoy that. If PureBasic didnt have a linux compiler, I wouldnt even glance at it, its still way in its cradle years. It needs years of polish yet to compete with the big boys. It WILL get there eventually, its got a very good start, with only a couple programmers and working on multiple platforms, it will take awhile, but in the end it will be worth it, mainly BECAUSE unlike the more commercial languages, Fred seems to CARE and take to heart the features users suggest.why make a VB clone of Purebasic?
There are alot of things this language has built in that make it a very good choice, but then on the flip side there are some nusiances that almost counter balance that. And usually those are the small things. I am trying to suggest features that fix those small nusiances so that PureBasic becomes a well rounded programing language

AMD 2600+, nVidia Geforce FX 5200 128 MB DDR, 512 DDR, RedHat 9