-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbol naming (libvgm prefix to reduce namespace conflicts) #59
Comments
sounds like a good idea to me EDIT: I think |
I actually had this come up a while ago (and I mean a while ago, don't remember the exact symbol anymore). I had a build of MPD with libvgm and kode54's fork of gme, which includes an older copy of VGMPlay. Certain VGMs would cause the player to crash due to resolving some of the symbols into libgme instead of libvgm. It was one of the emulator cores that's in C. I got around it by compiling with It would be a pretty big undertaking to change all those symbols to be prefixed but I could help if you want to go that route. Basically change anything that isn't |
Most of the functions in the actual cores should actually be What is non-static in the
|
Attaching a listing of global symbols, and a list of all symbols period from the emu library, for reference. So to clarify - should all symbols be prefixed with LVGM for consistency? For example, here's the symbols from Resampler.c:
If we just prefix the global symbols, there'd be a mis-mash of names like:
That could get frustrating if you're working on something in that file, and have to context switch between a global vs local function. Or maybe that helps make it obvious about what's an external-facing function? |
I don't think that the Also, an additional thought: For Windows, I need to explicitly indicate DLL export functions. (which I don't do right now, but on Windows I always went with static build so far anyway) This doesn't solve the functions with same name" problem, but it hides most of the internal sound core functions that I can't make "static" due to how the OPL/OPN core selection works currently. |
I don't think there will be a mishmash like that though, the symbols are sorted alphabetically. It will be pretty clear which symbols are exported and which ones are local. |
Re: providing a prefix for the Doing the visibility flag certainly helps - but like you mentioned, it doesn't do anything for a static library, at least not without some post-build steps (you can do a partial link with I would lean towards giving everything a prefix. |
We were discussing the naming of the various things in #58, and this made me think of something that actually has irked me for a little while.
I think that libvgm would definitely benefit if an effort is made to ensure that all exported symbols (and types) are in a libvgm namespace. Since C obviously doesn't have a namespace, this results to having to use a
libvgm
(or possibly an abbreviation likeLVGM
if it becomes too much to type) prefix in symbols and types.Not only does it reduce the likelihood that you would accidentally use a libvgm-reserved symbol in a big project, it would also make it easy to identify functions that call the libvgm library.
The old library name
vgm
was perhaps a little too generic for this change to actually be useful, but with the renaming of files tolibvgm
, it would break backwards compatibility for a moment, and I think that would make it a good opportunity to make this (admittedly big) change.The text was updated successfully, but these errors were encountered: