[fpc-pascal] Ansistrings exported in DLL's - mystery

L505 fpc505 at z505.com
Thu Jan 5 01:33:19 CET 2006

> i learned a few things from here:
> http://velthuis.homepage.t-online.de/articles/articles-pchars.html
> http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_howto5

I have seen Rudy's article too, and am reading the other website now, though.
I'm at the point where I feel 100 percent confident using Pchars at this point and
have started to write pages about pchars too. The mystery was why Trustmaster's
website has been working for 2-3 years now (or so) using ansistrings - defying all
the laws and warnings and hand wavings from people.

Also, I wrote this a while back and update it with new info too:

But it is overwhelming and mainly just notes for my own purposes, so some people
might find it too verbose to wade through.

With Cmem, and according to my current knowledge, Cmem should allow one to safely
export strings from one Pascal program to another Pascal program (but only Pascal
programs, or programs who have compatible reference counting - i.e. maybe Delphi).

Even if trustmaster's website does work fine with exporting strings without any Cmem,
it would be wiser to just use Cmem - as it doesn't really cost you anything, and
ensures things should work better than they are now, even if there are no problems

When considering a C program or library will interface in to the DLL, of course
pchars will be needed - one cannot use ansistrings even with cmem. And I'm fine with
that - since confident with pchars.

I didn't know about cmem and glad Jonas mentioned it. I still have to test it out
though, to make sure things work in real life like they do in theory, when having two
pascal applications talk to each other via cmem using ansistrings.

More information about the fpc-pascal mailing list