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

.NET Standard support #72

Closed
hez2010 opened this issue Mar 8, 2019 · 9 comments
Closed

.NET Standard support #72

hez2010 opened this issue Mar 8, 2019 · 9 comments

Comments

@hez2010
Copy link

hez2010 commented Mar 8, 2019

Can you add support for .NET Standard?
Then we can use libSBOL in .NET Core and .NET Framework apps.

Thanks.

@hez2010 hez2010 changed the title SEP 032: .NET Standard support SEP 032 -- .NET Standard support Mar 8, 2019
@jakebeal
Copy link
Contributor

jakebeal commented Mar 8, 2019

Not being familiar with .NET myself: would .NET support require building a new library, or is this something that can be added to libSBOL in a fairly lightweight manner?

@jakebeal jakebeal changed the title SEP 032 -- .NET Standard support .NET Standard support Mar 8, 2019
@jakebeal
Copy link
Contributor

jakebeal commented Mar 8, 2019

(ps: I have removed the "SEP" marker, since that is generally used for changes to the specification, and this is a request for changes to the library)

@hez2010
Copy link
Author

hez2010 commented Mar 8, 2019

@jakebeal
Both ways are ok for .NET.
Building a new library is ok but it might need a lot of works, but we can also use P/Invoke without building a new library.

On .NET we can use P/Invoke (Platform Invoke) to wrap shared libraries' methods so that .NET can invoke methods in shared libraries directly without changing their original codes. It is like JNI in Java but won't require changes in original libraries' code.

For example, an export function in a C++ shared library is:

extern "C" int test(int a, const char* b); // assume that its ordinal is 0

We can write in C#:

[DllImport("./xxx.so", EntryPoint = "#0", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] // the EntryPoint can be #ordinal or function name, so we can write either EntryPoint = "#0" or EntryPoint = "test"
static int Test(int a, [MarshalAs(UnmanagedType.LPStr)] string b);

And we can use it by calling Test(int, string).
With .NET Standard support, we can use SBOL in .NET Core on Windows/MacOS/Linux/Android/iOS and .NET Framework on Windows.

@jakebeal
Copy link
Contributor

jakebeal commented Mar 8, 2019

Sounds like it could be implemented in much the same way as pySBOL currently wraps libSBOL. Would you be interested in building that library? I expect the community would be happy to endorse it once it exists!

@hez2010
Copy link
Author

hez2010 commented Mar 8, 2019

I could to do this but it depends on my free time.

@jakebeal
Copy link
Contributor

jakebeal commented Mar 8, 2019

As with all of us. :-)

@cjmyers
Copy link
Contributor

cjmyers commented Mar 8, 2019 via email

@hez2010
Copy link
Author

hez2010 commented Mar 8, 2019

Sounds great.

@palchicz
Copy link
Contributor

closing this since it is now covered in SynBioDex/libSBOL#213

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

4 participants