[fpc-pascal] Better way to convert short string to pchar?

Ryan Joseph ryan at thealchemistguild.com
Fri Feb 23 04:21:07 CET 2018


I would like short strings so I can do concatenation easily but I need to pass pchar to a C function. Is there anyway to do this on the stack instead of allocating a string each time? I feel like it was possible to do some type casting but I don’t remember how.

pname := StrAlloc(Length(name) + 1);
StrPCopy(pname, name);
result := glGetUniformLocation(programID, pname);
StrDispose(pname);

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list