Page 1 of 1

About all those tantalising PB extras ..

Posted: Fri Sep 03, 2004 1:46 pm
by Dare2
I am sure I am not the only one who has looked in the PB directory and seen all the nifty extras in Library SDK and Source, but failed to understand what it was all about, or what the readme text files actually mean.

Perhaps those of us who want to know can use this thread to discuss and learn from those who do know and are willing to share?

And perhaps we can get enough info together to make a doc or help file for these things? Some simple enough for the Dare2s of this world to understand - and thus benefit from - the goodies.

Things like "What's the interface importer?" and "What's that Nasm folder there for?" and etc.

Posted: Fri Sep 03, 2004 1:50 pm
by Moonshine
Good idea Dare. I think the Lib SDK folder is very poorly documented and ts not clear what most of the stuff there is for.

For one, the interface importer works just like the header importer. Except rather than extracting the constants and structures, it extracts any interfaces it can find. Its a good idea to run both the header and interface importers on required headers just incase any are in there. However, also lik the header importer, it hardly ever outputs anything, if at all. Its rare to actually see anything come from either, except a load of .pb files sized at 0 bytes :roll:

Posted: Fri Sep 03, 2004 3:07 pm
by freak
The stuff in the LibrarySDK folder are basically the same tools we use to create the PureLibs.
Even if you think the stuff is badly documented. It was a pain to write even that documentation.
Coders and writing documentation... you know :wink:

I will try to give some overview here:


LibraryMaker
This is the tool used to create a PureBasic library out of a static .lib or .obj file.
The "Readme.txt" in the root sdk folder describes the rules for writing
the lib and using the LibraryMaker tool.
The descriptions are intended for people who know C or ASM, and how
to create a static library with the required calling conventions.
If you know that, the descriptions should be enough.

The "Nasm" and "LccWin32" folder contain examples in Asm and in C
for creating a library, and for some special things like how to create a PB gadget.

DllImporter
The DllImporter creates a wrapper library that makes the functions
available like WinAPI commands with an underscore at the end.
You will still need to distribute that dll with your Program, but it
is easier to code than using OpenLibrary() and CallFunction

It is basically the same as the libs you get with any C compiler that are
used for early binding with a dll.


DocMaker
If create a PureBasic library and want to create a helpfile in the same
style as the PB help, this is the way to go.
You have to write you help as a text file with some special keywords
marked by an '@'. The DocMaker then compiles this into a help file like
the PB help.

You can see an example text file in the Language subfolders.
You can also look at http://cvs.purebasic.com/ in the Documentation
folder, you see the whole PB documentation in that format.

InterfaceImporter
This tool can translate Interface definitions of C header files into PB code.
Note that this is just a *dumb* text parser, so the output will be incorrect
if the C file uses some strange syntax to define the Interface.
(for example, if inside the interface Macros are used.)

HeaderConverter
This tool can conver the rest of a C header file like Constant definitions,
Structures and Enumerations.

The same as for the InterfaceImporter applies to this tool even more.
Parsing C code correctly is a very complex thing, and these tools only
look for certain patterns and replace them. So the output must always
be checked.
But they do a good job in converting the simple things like constants
which would be really annoying to do by hand.

These 2 tools were written to work with the MS header files and the
LccWin32 ones. So if your C files use a compleetly different style to
define Structures/Interfaces, the output will be wrong.

If you get an empty output file, you probably tried a C++ file, which
of course doesn't work.


That's it.. i'm open for more questions :)

Timo

Posted: Fri Sep 03, 2004 3:19 pm
by Dare2
Heya Freak,

Thanks for the overview - and for the help in the beginners section :)

For me your post has clarified or organised my understanding a bit. And gives me some confidence in trying things (fear - of wiping out PB, for eg :? - made me wary of just jumping in and messing around).

I personally don't have any more Qs right now, but let me fall in a few holes and, like MacArthur, I will be back!

Posted: Fri Sep 03, 2004 4:17 pm
by GedB
Fear - of wiping out PB, for eg icon_confused.gif - made me wary of just jumping in and messing around
Been there, it's not a problem.

If you do damage any of the PB files then just run SmartUpdater. It will automatically put them all back to normal for you. Very clever tool.

Posted: Fri Sep 03, 2004 4:20 pm
by Dare2
That's handy to know. :)