It is possible, & the home centers sell a special roof vent just for this apllication. Be ready to vacuum the line, however, twice a year to be safe;yearly at a minimum. If it's possible to get one to vent outside the wall(closer is most preferable) Ive seen alot of damaged cause from these not being cleaned, fires from being clogged & near gas water heaters, etc.. Aside all of this... yes it can be vented out the roof... Seek all options b-4 using this option though..
Hope this helps & good luck to you! Chris from Va. beach, VA.