Skip to content
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

Unable to dynamically load extension node types from DLL on Windows #263

Open
mortenpi opened this issue May 21, 2022 · 0 comments
Open

Comments

@mortenpi
Copy link

For context: I am working on wrapping cmark-gfm in Julia to use it to extract the AST of a Markdown document. For that, I am dynamically opening the standard shared library products in Julia (i.e. with dlopen or LoadLibraryExW on Windows).

The node types for extensions (e.g. CMARK_NODE_STRIKETHROUGH) are stored as dynamic global variables (as opposed to compile time constants, as for the standard nodes). So when I try to interpret the cmark AST in Julia (e.g. whether a particular cmark_node is a strikethrough or not), I need to know those values (unless there is some other API for this that I missed).

However, those global variables are not decorated with CMARK_GFM_EXTENSIONS_EXPORT, and so on Windows, as far as I can tell, you can't actually read their value with GetProcAddress. I should say that on Linux and MacOS loading those variables with dlsym is fine, since I think everything is exported by default. I also tried patching cmark-gfm by adding CMARK_GFM_EXTENSIONS_EXPORTs to them and then GetProcAddress seems to work on them in Windows.

So, should all of these node type variables just be decorated with CMARK_GFM_EXTENSIONS_EXPORT? Or, if these variables are hidden from the library user for a reason, is there some API that I have missed or that should be created that could be used to determine if a cmark_node is of particular extension type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant