I have a DLL in which I have a function that returns a pchar. (as to avoid having to use borlndmm) What I was doing originally was casting a string as a pchar and returning that
When you return a string as PChar from function the string is held in stack, which is why it's sometimes corrupted. I use process heap memory for returning strings, or pointer to global buffer array of chars.
Also you can use built-in assembler and do this:
Function GetNameStr : PChar;
Asm
Call @OverText
DB 'Some text',0
@OverText:
Pop EAX
End;