Open for bug reports etc.
coffIT - create obj and lib static libraries from PB source!
coffIT - create obj and lib static libraries from PB source!
I may look like a mule, but I'm not a complete ass.
Not a bug report, just a query! Copied exacto from other forum and I'm just after what is safe. Eg, some things like Import, Interface, Psuedotypes. Esp Import would need care if available.
Would that be a complete list or have I missed something (or included something I shouldn't)?
Just making sure before I do something stupid and wonder what happened.
Have only played with the examples but this looks really exciting. Great job mate!
I have been through the manual a few times (fortunately it is easy to read and small) but I still need to request some clarification. Sorry!srod wrote:The help manual examines these problems quite thoroughly.
I assume this means all variables, types and operators and the following (I assume again) non-library commands:srod wrote:Of course the first question is whether static libs created with PB can be used in other languages? The answer is yes, providing that your library does not use any commands which reside within any of PB's user libraries!
Code: Select all
Break : Continue
Define
Dim : ReDim
End
Enumeration : EndEnumeration
For : Next
ForEach : Next
Global
Gosub : Return
Goto
If : Else : ElseIf : EndIf
Import : EndImport
Interface : EndInterface
Macro : EndMacro
NewList
Procedure : EndProcedure
Protected
Prototype
Pseudotype
Repeat : Until
Select : EndSelect
Shared
Static
Structure : EndStructure
Swap
While : Wend
With : EndWith Just making sure before I do something stupid and wonder what happened.
Have only played with the examples but this looks really exciting. Great job mate!
Dare2 cut down to size
Particularly clumsy bug fixed.
New version uploaded.
@Dare, all of the commands you've listed look fine to me. The proof of the pudding though is in the eating! Some things you just have to try and see what happens.
As for using the Import keyword in a .obj / .lib - that is fine; I've already tested this and it seems to work fine.
In fact rather than me arsing around, let me add an example of this right now!
Back in a mo...
@Dare, all of the commands you've listed look fine to me. The proof of the pudding though is in the eating! Some things you just have to try and see what happens.
As for using the Import keyword in a .obj / .lib - that is fine; I've already tested this and it seems to work fine.
In fact rather than me arsing around, let me add an example of this right now!
Back in a mo...
I may look like a mule, but I'm not a complete ass.
@Dare, I've added the following example to the coffIT download :
Run this through coffIT to create a .obj file.
Now when using the resulting 'ImportExternalLib.obj' in an application you must simply ensure that user32.lib is added to the application at the linking stage. In the case of building a PB application, if you use the coffIT generated import wrapper, then the wrapper will ensure that user32.lib is indeed added at the link stage. (It does this by simply adding an empty Import / EndImport for the 'user32.lib' import library)
Simple!
**EDIT : coffIT ignores macros (except the one used to export variables). Use macros by all means in your source, but avoid using a macro to mask a Procedure definition or a global variable definition etc.
Code: Select all
;coffIT demo program.
;By Stephen Rodriguez.
;Import an external lib.
Import "User32.lib"
MsgBox(Window.l, Body$, Title$, Flags.l) As "_MessageBoxA@16"
EndImport
ProcedureDLL CallImport(hWnd, text$)
MsgBox(hWnd, text$, "Hello from coffIT!", 0)
EndProcedure
Now when using the resulting 'ImportExternalLib.obj' in an application you must simply ensure that user32.lib is added to the application at the linking stage. In the case of building a PB application, if you use the coffIT generated import wrapper, then the wrapper will ensure that user32.lib is indeed added at the link stage. (It does this by simply adding an empty Import / EndImport for the 'user32.lib' import library)
Simple!
**EDIT : coffIT ignores macros (except the one used to export variables). Use macros by all means in your source, but avoid using a macro to mask a Procedure definition or a global variable definition etc.
I may look like a mule, but I'm not a complete ass.
After I've had some sleep!milan1612 wrote:Great work srod![]()
When can we expect the second version (*.lib output)?
And btw. does the name refer to the COFF format or
your immense COFFee consum during the creation?
I've got some other work to do at the moment - a few days worth, this will give coffIT's existing bugs time to show themselves etc.
Once version 1 has been demonstrated as being relatively stable then I will complete version 2, which adds .lib support. The truth is that the majority of the code is already in place for this. It's a case of reorganising and adding a little more logic in places.
I may look like a mule, but I'm not a complete ass.
You're welcome Pureabc.
@Milan : there is nothing stopping you using coffIT to create .libs right now (before version 2 is released).
All you need to do is split your source into individual source files, -say one for each function.
Run each function/file through coffIT and then use POLIB on all the resulting .obj files to create a .lib.
The only thing is that you will need to export all data (e.g. variables) which needs to be shared amongst the functions etc. and also export all 'internal' functions so that they are accessible throughout the library.
@Milan : there is nothing stopping you using coffIT to create .libs right now (before version 2 is released).
All you need to do is split your source into individual source files, -say one for each function.
Run each function/file through coffIT and then use POLIB on all the resulting .obj files to create a .lib.
The only thing is that you will need to export all data (e.g. variables) which needs to be shared amongst the functions etc. and also export all 'internal' functions so that they are accessible throughout the library.
I may look like a mule, but I'm not a complete ass.
-
BriceManuel
- Enthusiast

- Posts: 195
- Joined: Thu Nov 29, 2007 8:23 am
Static libs are not intended to replace dll's Brice because, as you know, dll's have already passed through the linking stage and so using PB functions in a dll is not a problem.
.libs (if you intend using them in other languages) should stick to the basic command set + Win api. You would of course build up a library of routines this way until you had a rich base of functions etc.
Of course, with c static libs, things are made somewhat easier by the runtime library; which is always an option in PB. There's no reason why static libs created with PB cannot make use of the c runtime etc. I certainly intend to.
On an aside, I must admit that I've had no problems using PB created dll's with other languages. Is there any particular language you've had problems with when attempting to use PB created dll's?
On another aside, can you check your pm's please Brice?
.libs (if you intend using them in other languages) should stick to the basic command set + Win api. You would of course build up a library of routines this way until you had a rich base of functions etc.
Of course, with c static libs, things are made somewhat easier by the runtime library; which is always an option in PB. There's no reason why static libs created with PB cannot make use of the c runtime etc. I certainly intend to.
On an aside, I must admit that I've had no problems using PB created dll's with other languages. Is there any particular language you've had problems with when attempting to use PB created dll's?
On another aside, can you check your pm's please Brice?
I may look like a mule, but I'm not a complete ass.
-
BriceManuel
- Enthusiast

- Posts: 195
- Joined: Thu Nov 29, 2007 8:23 am
Didn't know that, I'm gonna give it a try...srod wrote:@Milan : there is nothing stopping you using coffIT to create .libs right now (before version 2 is released).
All you need to do is split your source into individual source files, -say one for each function.
Run each function/file through coffIT and then use POLIB on all the resulting .obj files to create a .lib.
The only thing is that you will need to export all data (e.g. variables) which needs to be shared amongst the functions etc. and also export all 'internal' functions so that they are accessible throughout the library.
Thanks for the hint
Windows 7 & PureBasic 4.4


