Ah, now I get it. You want to write a DLL for that. The easiest form of cross-fading is gradually levelling the amplitudes of the last samples towards the amplitude of the first sample.
Pseudo code:
; GetSampleValue() picks a value at the given position
; SetSampleValue() writes a value at the given position
; SampleLength is the number of values in the sample
; CFLength is the length of the crossfade (number of values)
For i = CFLength-1 to 0 step-1
endValue = GetSampleValue(SampleLength-i)
startValue = GetSampleValue(i)
resultValue = ((endValue*i) + (startValue*(CFLength -i)) / CFLength
SetSampleValue(SampleLength-i, resultValue)
Next i
This example shows a linear crossfading which is (most of the time) not the best solution. Proportional calculations may have better results.
Another approach is to take "both ends" and level them towards each other. While that may cause fewer audio artifacts (again that depends on the material), the first solution will sound better with sounds that have a dominant attack phase.