Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#31 C++Builder 2010: SetPort linker error

open
nobody
None
5
2010-09-15
2010-09-15
PKy
No

C++Builder won't link if you use the Port property. Below is a workaround. I don't know if this is because TPort is typedeffed as string, and hence the linker try to use UnicodeString as the type for SetPort function.

To TCustomComPort 's interface part, like line 428

// PKy 7.9.2009. Easier portability to C++ Builder which doesn't like TPort for some reason
procedure SetPortString(const Value: string);

And to implementation part to TCustomComPort, like before TCustomComPort.SetPort:

// PKy 7.9.2009. Help using on C++ Builder 2007
// set port
procedure TCustomComPort.SetPortString(const Value: string);
var
LPort:TPort;
begin
LPort := Value;
SetPort(LPort);
end;

Now use SetPortString instead of Port="COM1"

Discussion