If this is a very young dog, ts possible you might be seeing an eye condition called "cherry eye". In any event, the dog needs to be seen by a vet, as Jaybay said. It could well be an infection and need treatment asap.
The black hard stuff is nothing to worry about. All dogs get some kind of eye-boogers - just like people do. :-) It sounds like he might have a bit of an infection causing excess tears that picks up dirt and results in black eye boogers.
You'll need to have your vet take a look at the eyelid, and will probably need some antibiotic drops to get it better. Don't let it go without treatment, or you'll end up with a bigger and far more expensive problem.