What is the use of this sharp edge found on the leading edge of a DA 40NG wing?
I'm leaving the aerodynamics to someone who paid more attention in classes but, as I remember, that leading edge is supposed to induce flow separation at lower angles of attack (for that portion of the wing), inducing a small buffet into the ailerons and a buffet feed-back to the pilot through the control stick. 

Without it, the wing would begin separation (and stalling) at the root, and by the time you get the buffet in the stick the whole wing is basically already stalled.