It's completely legal. It doesn't hack anything, basically you're doing one big system link (or LAN play, if you prefer)
BTW, IMO the best way to play gba games with a flashcart on ds is with a GBA flashcart. I just have both flashcarts in mine, works like a charm
GBA flashcarts are ridiculously expensive though, because they need really good Flash RAM in them that reads as it plays. DS loads into its internal RAM, so it can use slow stuff like sd cards.
Wait, why do you need GBA flashcart loading if it supports gba emulation?
I think I'll take my R4 clone that cost $10, SDHC, came with a 2gb SD card. All those features just don't seem worth $25. Plus, this r4 clone was super easy to set up (at least compared to my EFA Linker for the GBA.)