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

Implement C wrappers #359

Open
azmeuk opened this issue Jun 8, 2022 · 7 comments
Open

Implement C wrappers #359

azmeuk opened this issue Jun 8, 2022 · 7 comments

Comments

@azmeuk
Copy link

azmeuk commented Jun 8, 2022

I would like to use lomse in a GTK C program. I could implement C wrappers for lomse in my application, but maybe it would be better to implement them directly in lomse so other people could use them.
What do you think?

@cecilios
Copy link
Member

cecilios commented Jun 8, 2022

Thanks for your proposal.

IMO it is always better to keep the wrapper separate from your application, so that other people could benefit from it and contribute. I have no experience in writing C wrappers but it will be necessary to define a C API for Lomse and there could be problems with smart pointers, std strings or other, as well as with exceptions. Perhaps it will be necessary to remove exceptions from Lomse or to create in the C wrapper an additional layer of C++ that handles exceptions.

I like the idea and will try to help with any convenient changes in Lomse. The C wrapper is also an opportunity to improve the C++ API and will help to define public and private lomse headers.

I would start the C wrapper in a separate repo (either in your account, in Lenmus account or in any other place, I don't mind), to gain experience and knowledge about its viability, the C API, the required changes in Lomse, etc. And once we are sure, we could decide if it should be integrated in Lomse repo or maintained as a separate repo. A naive question: Any gain in merging in Lomse repo? I only see an increment in Lomse sources without any gain for people don't using the C wrapper, but as said, I have no experience on this.

@azmeuk
Copy link
Author

azmeuk commented Jun 8, 2022

Thank you for your answer. I might give a try depending on how much time I can spend on this.

Any gain in merging in Lomse repo?

It would ensure that the C wrappers would fit the C++ API. A separate project could be outdated if the C++ API changes.

@cecilios
Copy link
Member

cecilios commented Jun 8, 2022

I might give a try depending on how much time I can spend on this.

Time is always the problem! ;)

A separate project could be outdated if the C++ API changes.

Depends on how repos are related and on automated test before merging Lomse PRs. Let me think on this.

@andre2007
Copy link

Providing a C wrapper would be fantastic. I would like to use Lomse within a project developed in the D Programming Language. By providing a C wrapper you would open the door to almost any programming language.

@cecilios
Copy link
Member

By providing a C wrapper you would open the door to almost any programming language

Probably, but first there must be team of contributors to develop and maintain the project. I can not do more alone. Feel free to contribute to develop the C wrapper or to do any other task.

@andre2007
Copy link

Thanks for the info. My C knowledge is quite limited and my C++ knowledge is even worse.
I just did a Google search and it seems SWIG is maybe able to automatically generate the C wrapper code.

@cecilios
Copy link
Member

Thank you for the info. I know nothing about SWIG and probably could be of help. But for sure implementing a C wrapper, even using SWIG, will require an amount of work that, currently, I can not afford. Think that, even having good knowledge of SWIG (and it this is not the case), just testing the Lomse C wrapper and writing automated tests and documentation will be a lot work.

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

3 participants