[Mono-dev] Mono vs. Net Core and p/invoke to native libraries on multiple OS/platforms
linqdan2000 at gmail.com
Tue Dec 6 15:57:37 UTC 2016
Thanks. That helps a lot. I am thinking a static initializer to set the shared library filename; however, i would like to provide some way to override this maybe via a config file in case a certain platform uses a different filename than what is determined in the static initializer.
Since what I am doing is based on Mono, i am thinking of having #if around code for . Net core vs. .net fx or mono. This is so any bug fixes could find their way back to the Mono project. Especially the Oracle client.
> On Dec 5, 2016, at 10:05 AM, David Curylo <curylod at asme.org> wrote:
> On .NET Core, you determine the platform like this (full namespaces since this is a new spot):
> As far as a configuration to map to libraries with different names per platform, I don’t believe there is a solution yet, but hope someone can prove me wrong. It would be messy to have multiple “extern” methods decorated with the different platform-specific names and call the appropriate method based on the “IsOSPlatform” checks above, but I guess that would work.
>> On Dec 4, 2016, at 10:47 PM, Daniel Morgan <linqdan2000 at gmail.com> wrote:
>> How do I determine what operating system/platform
>> .net core is running on?
>> On Mono, you could handle different library names and file extensions via a config file for the library. .net framework does not have this. Not sure about .net core.
>> Example, i have a library foo.dll on Windows, libfooclient.so on Linux and libfoo.dynlib on macOS.
>> I ported mono's old Odbc to .net core. Porting the .Net Reference implementation would be better, but this was an effort so we could connect to data sources with no .net core data access provider like IBM DB2 now.
>> Same thing with the oracle client i ported, i need to modify it to work on Linux too.
>> Any suggestions?
>> danmorg on GimpNet IRC
>> Begin forwarded message:
>>> From: Daniel Morgan <linqdan2000 at gmail.com>
>>> Date: November 11, 2016 at 9:44:42 AM EST
>>> To: mono-devel-list at lists.dot.net
>>> Subject: Oracle .net core provider
>>> I took Mono Project's System.Data.OracleClient implementation and modified it for .net core. It works on .net core via visual studio 2015 on a Windows 10 64-bit machine with a local Oracle 12c database. Feel free to fork it.
>>> This was done in one evening to get it to build and run. It will need to be reviewed and cleaned up.
>>> Some notes:
>>> - string.Copy does not exist in .net core so i just called ToString or set a reference. So, i need to re-visit that code in oci define handles and parameters.
>>> - no DataTable so a lot of code for getting schema and db data adapter was commented.
>>> - string.Compare(string, string, bool, globalization) did not exist but Compare(string, string, bool does.
>>> - remove all design-time component attributes
>>> - added various usings for the different namespaces for some stuff
>>> - added reference to System.Data.Common
>>> - I may have added SqlClient as well for SqlTypes.INullable. Added other references to satisfy errors.
>>> What would it take to build a EF Core provider for Oracle?
>>> Been awhile since i played with Mono.
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.dot.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list