Hoping to unlock Sonic in Super Mario 64 DS? Sorry to disappoint, but you can't—no way.
There's simply no method to add Sonic to the roster, so you'll have to enjoy the game's actual cast of playable characters instead.