[fpc-pascal] DLL call works on FPC 2.6.4 but not with D7

Paul Breneman Paul2006 at BrenemanLabs.com
Tue Jul 1 19:42:52 CEST 2014


On 07/01/2014 01:28 PM, Jonas Maebe wrote:
> On 01/07/14 19:06, Paul Breneman wrote:
>> Thanks Jonas for the help!  This now works for me in FPC (MyReturnStr is
>> PChar):
>>        Status := ps5000aGetUnitInfo( ps5000a_handle, @MyReturnStr[ 0],
>> StringLen, requiredSize, RInfo);
>>
>> But in D7 using "@MyReturnStr[ 0]" gives an Access violation exception
>> in the dll.  The address the DLL is trying to write is about the same as
>> in FPC so I still don't understand why FPC works but D7 doesn't.
>
> How are you allocating space for MyReturnStr?

I'm doing the same thing in FPC and D7:
       StringLen := 14;
       MyReturnStr := 'test1234567890';
       Status := ps5000aGetUnitInfo( ps5000a_handle, @MyReturnStr[ 0], 
StringLen, requiredSize, RInfo);




More information about the fpc-pascal mailing list