[Mono-osx] Invoke CIL/Managed Code from ObjC/XCode on Mac
Duane Wandless
duane at wandless.net
Mon Oct 27 12:04:02 EDT 2008
Yes using the pkg-config is the correct way to find the settings. Which is
exactly what I did. However, with Xcode you cannot execute scripts in the
build settings.
I gave enough details on how to easily embed a DLL within ObjC. Change the
reference in main.m from MacMonoClient.exe to MacMonoClient.dll. Change the
mono_jit_exec to something like this:
MonoClass *klass = mono_class_from_name (mono_assembly_get_image
(monoAssembly), "MacClient", "SetMeUp");
MonoObject *newObject = mono_object_new(domain, klass);
if(newObject != NULL) {
mono_runtime_object_init (newObject);
}
Of course have a CSharp class SetMeUp. This by the way is what I did in
1.9, which no longer works in 2.0. The SetMeUp constructor invoked the
Monobjc initilization methods.
Then try to invoke an internet request:
HttpWebRequest httpReq = CreateHttpRequest(uri, false);
Please do update me on how calling the embedded DLL sets up the
configuration information.
Thanks for your help.
Duane
On Mon, Oct 27, 2008 at 11:20 AM, Paolo Molaro <lupus at ximian.com> wrote:
> On 10/25/08 Duane Wandless wrote:
> > For me anyway I hit a bug in 2.0 that required me to load an EXE rather
> than
> > a DLL.
>
> It is not a bug in mono 2.0, it is a bug in your code because you didn't
> call mono_jit_exec () at all or on an executable assembly.
>
> > -I/Library/Frameworks/Mono.framework/Versions/2.0/include/mono-1.0
> > -I/Library/Frameworks/Mono.framework/Versions/2.0/include/glib-2.0
> > -I/Library/Frameworks/Mono.framework/Versions/2.0/lib/glib-2.0/include
> > - Other C++ Flags = $(OTHER_CFLAGS)
> > - OTHER_LDFLAGS = -pthread
> > -L/Library/Frameworks/Mono.framework/Versions/Current/lib -lmono
> -lpthread
> > -lm -lgthread-2.0 -lglib-2.0 -lintl -rpath at loader_path/../Libraries
>
> As the documentation shows, you should use:
> pkg-config --cflags mono
> and
> pkg-config --libs mono
>
> Hardcoding the paths is incorrect as that will break with newer mono
> versions.
>
> lupus
>
> --
> -----------------------------------------------------------------
> lupus at debian.org debian/rules
> lupus at ximian.com Monkeys do it better
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20081027/e0937fa3/attachment.html
More information about the Mono-osx
mailing list