But don't fix a fence to the top of the wall, as it will pull the bricks off.
My preferred method is to dig a bucket-sized hole next to the wall, and you will have to avoid its foundations, and concrete in a concrete fence spur, placed about four inches from the wall. After setting preferably for a damp week, you will then place your wooden fence posts between the spur and the wall, raised above ground level to avoid rot, and bolted to the spur with the holes provided.
The concrete for the spur's foot does not need to come up to ground level, where if will be unsightly. If for some reason you want it to, place formwork, such as an open-ended wooden box, or a plastic ice cream tub, on the concrete mix as you place it so the top is at your desired finished level, and place the last shovel into that, smoothing it off with a slight slope to shed rain. When it is cured and you remove the form, you will only see a neat concrete pad round the bottom of the spur.
If you dislike the appearance of concrete, you can paint it with masonry paint before building the fence, to match the wall or the fence. I paint mine in "bitter chocolate" to tone with the dark fence stain, it also blends into vegetation and earth.
If you only want a low fence, such as post and rail, you can bolt rails direct to the spur with no wooden fencepost.
The masonry paint also extends the life of the concrete by preventing rain penetration, which causes cracks when it freezes.
If the fence is rails only, or not intended to stay for long, you can put the spurs in earth and beat it down hard.