Make a lib (from C-Code) and get Esgrid!

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re:

Post by IceSoft »

Marco2007 wrote::(

Anyone else?
Maybe I can do it.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: Re:

Post by MachineCode »

Thanks, LJ. :)
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Make a lib (from C-Code) and get Esgrid!

Post by Shardik »

milan1612's pdf2text.zip contains the following code example:

Code: Select all

Prototype.l ExtractPDFTextProto(PdfFile.s, OutputFile.s)
If OpenLibrary(0, "pdf2text.dll")
  Global ExtractPDFText.ExtractPDFTextProto = GetFunction(0, "ExtractPdfText")
Else
  End
EndIf

If Not ExtractPDFText("c:\LTB2658_1.pdf", "c:\LTB2658_1.txt")
  MessageRequester("Error", "Could not extract pdf text!")
EndIf
Although this code example works it contains a nasty bug which
you will experience if you put the ExtractPdfText function into a
procedure: you will see a crash in the procedure because you have
to use PrototypeC instead of Prototype... :wink:

For an explanation take a look into the PureBasic blog:
freak wrote:Here we get to the reason why it works outside of a procedure and not inside. A call to a procedure stores the address where execution continues after the procedure on the stack as well. If a function call inside the procedure leaves the stack in a mess, then the ProcedureReturn cannot find the address to continue and uses a wrong value instead which leads to a crash. Outside of a procedure, nobody will notice the stack mess, as the stack is only used for function calls.
Post Reply