Page 1 of 1

[DONE] 1.877 / 4.30b4: String Problem

Posted: Thu Nov 06, 2008 2:53 pm
by Vladi
Is this a known bug? What is the status?

Lib:

Code: Select all

ProcedureDLL$ proc(a)
   ProcedureReturn Str(a)
EndProcedure

ProcedureDLL$ p(b)
   ProcedureReturn proc(b)
EndProcedure
Pgm:

Code: Select all

Debug proc(3)

Debug p(2)
Second statement crashes.

Posted: Thu Nov 06, 2008 4:17 pm
by gnozal
It's a known limitation with PB versions >= 4.20.

Don't call exported string functions in your library, because of the 'RET X+4' fix : see http://www.purebasic.fr/english/viewtop ... e&start=22

Just add a 'dummy' function through which the exported string function operates.

Posted: Thu Nov 06, 2008 4:52 pm
by Vladi
Thanx for your prompt answer. But what do you mean with a dummy function? I think any other function in between (inside the lib) will crash as well?

And the "limitation" will stay? Don't you think it will make user libs unusable for anything other than elementary functions?

Posted: Thu Nov 06, 2008 5:05 pm
by gnozal
Vladi wrote:Thanx for your prompt answer. But what do you mean with a dummy function? I think any other function in between (inside the lib) will crash as well?
You could do it like this :

Code: Select all

; proc
Procedure$ proc_private(a) ; private
  ProcedureReturn Str(a) 
EndProcedure 
ProcedureDLL$ proc(a) ; exported
  ProcedureReturn proc_private(a) 
EndProcedure 
;
ProcedureDLL$ p(b) 
  ProcedureReturn proc_private(b) ; use private version in your library
EndProcedure

Code: Select all

Debug proc(2)
Debug p(2)
Vladi wrote:Don't you think it will make user libs unusable for anything other than elementary functions?
No, you only have to use a 'dummy' function if you call an exported string function inside your library.
No problems with non string functions, private string functions or with exported string functions not called from inside the library.

Posted: Fri Nov 07, 2008 4:31 pm
by Vladi
Ok, that's not nice, but it works, thanks.
But I think you should mention something about this in the manual...

Posted: Tue Nov 11, 2008 9:57 pm
by ABBKlaus
Thanks Vladi.
The help file is updated. You can read it online : http://www.tailbite.com/help/index.html