[fpc-pascal] String passing parameters DLL-DLL

afpTeam afpteam at sbcglobal.net
Wed Sep 20 20:49:36 CEST 2006


I've come back to the list still looking for some advice on the best 
approach to handling strings as parameters being passed byRef out and back 
into an FPC DLL, talking to a win32 gui based DLL that wants AsciiZ strings.

Looking at how much automation FPC does with typecasting, I've tried several 
ways in Delphi mode, to use straight typecasting to manage it, but 
unfortunately passing pchars, continues to leave me having to reset the 
value of the pchar for reusing them and apparently setting pchars equal to 
an empty string causes the pchar to become read-only which then fails as a 
byRef returning new data, if I'm understanding the docs properly.

I have several different calls that will re-use the same variables or pchars 
and it appears I can do these as a constant, faking the pass into thinking 
it's passing an expression, or set up pointer memory management, or possibly 
I'm just not understanding the best way to do it by straight typecasting.

The variables are mostly globals because of their reuse.  I'm using FPC 
2.0.2 and really frustrating on which is the best approach to use for 
reliable operation over the long run.

Given some of the unique capabilities of FPC, there aren't a lot of 
reference material to look up for guidance on advanced string management, so 
I'm hoping some of the development team would suggest briefly which methods 
might be best and what if any examples I can look up to help me get past 
this point of my inexperience in this area.

Thanks as always, for any examples to see, tutorials at this level, or 
personal opinions as to what would be the best approach??


avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0638-0, 09/19/2006
Tested on: 9/20/2006 2:49:38 PM
avast! - copyright (c) 1988-2006 ALWIL Software.

More information about the fpc-pascal mailing list