mono / Embeddinator-4000

Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
MIT License
758 stars 95 forks source link

Support returning .NET 5 threads to ObjC #775

Open ghost opened 4 years ago

ghost commented 4 years ago

My .Net class library that I want to embeddinate contains two simple threads that I start.

Steps to Reproduce

  1. Build VB IOS class library .Net Standard project on Mac My .NET IOS class lib starts two threads...............
        Imports System.Threading
        Imports System
        Imports System.IO

        dim RF_glucose_Thread as thread
        RF_glucose_Thread = new Thread( AddressOf RF_glucose_executive )
        RF_glucose_Thread.Name = "RF GLUCOSE ALG"
        RF_glucose_Thread.Start()       

        public embedded_communication_thread as thread
        embedded_communication_thread = new Thread( AddressOf run_acquisition_session )
        embedded_communication_thread.Name = "COMM RF HW"
        embedded_communication_thread.Priority =  std.RF_HW_COMMUNICATION_THREAD_PRIORITY
        embedded_communication_thread.Start()               
  1. Run objcgen to generate ObjC from .Net

Expected Behavior

ObjC generation of threading used within library

Actual Behavior

objcgen outputs: error EM0009: The feature Returning type Thread from native code is not currently supported by the tool

Environment

.Net Standard 2.0

Build Logs

Example Project (If Possible)

chamons commented 4 years ago

The tool does not support passing threads to Objective-C, as we'd have to bind all of the API you can invoke on threads as well.

You should be able to create a wrapper with a limited subset of functions (and it not public).

I'll keep this open as a feature request.