Le 17/08/2019 à 15:00, James Richters a écrit :

Function TLibUsbInterface.FindEndpoint(MatchFunc : TLibUsbEndpointMatchMethod) : Plibusb_endpoint_descriptor;

MatchFunc(ED) is where the access violation occurs, but I can’t trace any further because I can’t find the function MatchFunc()   I just don’t understand where the actual function is.

MatchFunc is a parameter (its type is TLibUsbEndpointMatchMethod) of TLibUsbInterface.FindEndpoint.

To find which function is actually called, you should trace back where TLibUsbInterface.FindEndpoint is called and what function is provided as parameter MatchFunc.

It's likely you'll have to "climb up" through several calls, may be that TLibUsbInterface.FindEndpoint has itself a parameter MatchFunc

If you use the debugger, the callstack and a breakpoint just before the offending call to MatchFunc should help you to find from where comes your MatchFunc.

I wouldn't be surprised that it resolves somewhere to an overridden method Match of an instance of a class derived from TLibUsbDeviceMatchClass, likely TLibUsbDeviceMatchVidPid.Match, TLibUsbDeviceMatchVidPidSerial.Match or TLibUsbInterfaceMatchNumAlt.Match from unit libusbutil.pas

This can sound difficult  for you at the beginning if you're not too much accustomed with variables of type procedure and inheritance, but after a few practice it's not that complicated.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to