How to receive an 'odoc' (open document) Apple event in macOS?

I want to use my SDL application to open certain document types via macOS finder, e.g, via Finder’s context menu’s “Open With …”. When a user makes this selection Finder lauches the app and sends it an odoc (open document) Apple event with the file path. (There is nothing in the app’s argv array). How can I get my SDL app to receive such events?

I’m still using SDL2.

I’ve not found anything remotely helpful in my internet searches so far.

I found out how to do it with some initial help from spelunking into the source code. Use the SDL_DROPBEGIN, SDL_DROPFILE and SDL_DROPCOMPLETE events. The odoc Apple event sent by Finder/LaunchPad is transmogrified into these SDL drop events.

The documentation, at least that for SDL 2.0, is pretty minimal. For example there is no description of SDL_DROPBEGIN and SDL_DROPCOMPLETE. Hopefully anyone in future searching for “odoc” and “SDL” will find this topic.

One difficulty I am encountering is that, while dragging and dropping multiple files results in a single DROPBEGIN, DROPCOMPLETE sequence with multiple DROPFILE events, opening multiple files via Finder’s “Open With” or by double-clicking with multiple files selected results in a DROPBEGIN, DROPCOMPLETE sequence for each file.