Crow.userprefs
Debug
packages
+*.o
*.nupkg
/GOLib.suo
/tmp
<CustomCommands>
<CustomCommands>
<Command type="Build" command="make" />
- <Command type="Execute" command="make run" externalConsole="True" pauseExternalConsole="True" />
+ <Command type="Execute" command="make run" workingdir="" externalConsole="True" pauseExternalConsole="True" />
</CustomCommands>
</CustomCommands>
</PropertyGroup>
CC = gcc
CFLAGS = -Wall -Wextra -O2 -g -DDEBUG
-LDFLAGS =
+LDFLAGS = -L/devel/crow/build/Debug
TARGET = mdembed
SOURCES = main.c
OBJECTS = $(SOURCES:.c=.o)
+CFLAGS += -lcrow
CFLAGS += `pkg-config --cflags --libs mono-2`
CFLAGS += `pkg-config --cflags --libs cairo`
CFLAGS += `pkg-config --cflags --libs gl`
.PHONY: run
run:
- -./${TARGET} test.exe
\ No newline at end of file
+ -./${TARGET} ../build/Debug/testDrm.exe
#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glext.h>
+#include "../../libcrow/libcrow.h"
/*
* Very simple mono embedding example.
assembly = mono_domain_assembly_open (domain, file);
if (!assembly)
exit (2);
- a2 = mono_domain_assembly_open (domain, "test2.exe");
- if (!a2)
- exit (2);
+ //a2 = mono_domain_assembly_open (domain, "../build/Debug/testDrm.exe");
+ //if (!a2)
+ // exit (2);
/*
* mono_jit_exec() will run the Main() method in the assembly.
* The return value needs to be looked up from
* System.Environment.ExitCode.
*/
mono_jit_exec (domain, assembly, argc, argv);
- mono_jit_exec (domain, a2, argc, argv);
+ //mono_jit_exec (domain, a2, argc, argv);
}
int
* We add our special internal call, so that C# code
* can call us back.
*/
- mono_add_internal_call ("MonoEmbed::gimme", gimme);
+ mono_add_internal_call ("Crow.Native.LibCrow::gimme", gimme);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_context_create", crow_context_create);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_context_destroy", crow_context_destroy);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_context_set_root", crow_context_set_root);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_context_process_clipping", crow_context_process_clipping);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_context_process_layouting", crow_context_process_layouting);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_context_process_drawing", crow_context_process_drawing);
+
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_object_create", crow_object_create);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_object_destroy", crow_object_destroy);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_object_set_type", crow_object_set_type);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_object_do_layout", crow_object_do_layout);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_object_register_layouting", crow_object_register_layouting);
+
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_object_child_add", crow_object_child_add);
+ mono_add_internal_call ("Crow.Native.LibCrow::crow_object_child_remove", crow_object_child_remove);
main_function (domain, file, argc - 1, argv + 1);
static void Main() {
Console.WriteLine ("test2 => " + gimme ());
+
}
}
// THE SOFTWARE.
using System;
using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
namespace Crow.Native
{
- internal static class LibCrow
+ public static class LibCrow
{
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public unsafe extern static string gimme();
#region PINVOKE
const string lib = "libcrow";
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern IntPtr crow_context_create ();
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern void crow_context_destroy (IntPtr ctx);
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
unsafe internal static extern void crow_context_set_root (IntPtr ctx, crow_object_t* root);
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern void crow_context_process_layouting (IntPtr ctx);
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern void crow_context_process_clipping (IntPtr ctx);
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern void crow_context_process_drawing (IntPtr ctx, IntPtr cairoCtx);
- [DllImport(lib)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
unsafe internal static extern crow_object_t* crow_object_create();
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
unsafe internal static extern void crow_object_destroy(crow_object_t* go);
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
unsafe internal static extern void crow_object_set_type (crow_object_t* go, CrowType objType);
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
unsafe internal static extern byte crow_object_do_layout (crow_object_t* go, LayoutingType layout);
- [DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
unsafe internal static extern byte crow_object_register_layouting (crow_object_t* go, LayoutingType layout);
public int a = 10,b=20;
}
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- unsafe extern static string gimme();
+
[DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
internal static extern void registerICall ();
static void Main(){
- registerICall ();
- Console.WriteLine (gimme());
+ //registerICall ();
+ Console.WriteLine (Crow.Native.LibCrow. gimme());
- /*using (Interface iface = new Interface ()) {
+ using (Interface iface = new Interface ()) {
Console.WriteLine ("is dirty: {0}", iface.IsDirty);
iface.ProcessResize (new Rectangle (0, 0, 1024, 768));
iface.LoadInterface ("#testDrm.ui.go.crow");
iface.Update ();
iface.DumpTo ("/home/jp/test.png");
- }*/
+ }
}
}
}