Skip to content

Instantly share code, notes, and snippets.

View tombly's full-sized avatar

Tom Bulatewicz tombly

View GitHub Profile
Embeddinator-4000.exe -gen=c -out=foo Foo.dll
// instead of this:
var intent = new Intent();
intent.SetAction(notificationName);
intent.PutExtra(keyName, value);
Application.Context.SendBroadcast(intent);
// we can do this:
IntentFilter filter = new IntentFilter();
filter.addAction(notificationName);
context.registerReceiver(new BroadcastReceiver() {
// instead of this:
myLibrary.something();
// we can do this:
CountDownLatch latch = new CountDownLatch(1);
new Handler(Looper.getMainLooper()).post(() -> {
myLibrary.something();
    latch.countDown();
});
latch.await();
// instead of this:
myLibrary.myMethod(myDictionary);
// we can do this:
myLibrary.myMethod(myDictionary.toJSON());
// instead of this:
myLibrary.something(myList);
// we can do this:
// instead of this:
myLibrary.myMethod(myDataObject);
// we can do this:
myLibrary.myMethod(myDataObject.toJSON());
int32_t Mobile_AndroidOS_MyClass_MyMethod(Mobile_AndroidOS_MyClass* object, const char* input) {
  const char __method_name[] = "Mobile.AndroidOS.MyClass:MyMethod(string)";
  static MonoMethod *__method = 0;
if (!__method) {
    __lookup_class_Mobile_AndroidOS_MyClass();
    __method = mono_embeddinator_lookup_method(__method_name, class_Mobile_AndroidOS_MyClass);
  }
MonoObject* __instance = mono_gchandle_get_target(object->_handle);
  void* __args[1];
  MonoString* __input_0 = (input) ? mono_string_new(__mono_context.domain, input) : 0;
public class MyClass implements MyInterface {
public Pointer __object;
  public MyClass(Pointer var1) {    
   this.__object = var1;
  }
  public Pointer __getObject() {    
    return this.__object;  
  } 
  public MyClass() {    
    this.__object = Native_Mobile_Android.INSTANCE.Mobile_AndroidOS_MyClass_new();
- (int)myMethodInput:(NSString *)input {
const char __method_name [] = "Mobile.iOS.MyClass:MyMethod(string)";
__method = mono_embeddinator_lookup_method (__method_name, Mobile_iOS_MyClass_class);
MonoObject* __result = mono_runtime_invoke (__method, __instance, __args, &__exception);
void* __unbox = mono_object_unbox (__result);
return *((int*)__unbox);
}
@interface Mobile_iOS_MyClass : NSObject <Mobile_iOS_MyInterface> {
@public MonoEmbedObject* _object;
}
- (nullable instancetype)init;
- (int)myMethodInput:(NSString *)input;
- (nullable instancetype)initForSuper;
@end
namespace Mobile.iOS {
public interface MyInterface {}
public class MyClass: MyInterface {
public int MyMethod(string input) {
return 0;
}}}