[Mono-osx] CoreWlan Framework binding problem

Ashok Gelal ashokgelal at gmail.com
Tue Jan 18 15:15:58 EST 2011


Awesome! That's seems to work. But can you please explain why I need to call
the following:

dlopen("/System/Library/Frameworks/CoreWLAN.framework/CoreWLAN", 0);

Thanks again. When I get some free time, I will rewrite the CoreWlan sample
and will ask someone on git to pull it.

ashok

On Mon, Jan 17, 2011 at 8:28 AM, Duane Wandless <duane at wandless.net> wrote:

> Try something like this:
>
> [System.Runtime.InteropServices.DllImport ("/usr/lib/libSystem.dylib")]
> public static extern IntPtr dlopen (string path, int mode);
> [System.Runtime.InteropServices.DllImport("/usr/lib/libSystem.dylib")]
> public static extern string dlerror(); static void Main (string[] args) {
> dlopen("/System/Library/Frameworks/CoreWLAN.framework/CoreWLAN", 0);
> Console.WriteLine("load error = {0}", dlerror()); NSApplication.Init ();
>                 var interfaces = CWInterface.SupportedInterfaces();
>  NSApplication.Main (args);
> }
>
> Duane
>
>
>
> On Sun, Jan 16, 2011 at 11:26 PM, Ashok Gelal <ashokgelal at gmail.com>wrote:
>
>> Hello All,
>> Right now I'm working on rewriting a popular open source software inSSIDEr
>> from MetaGeek http://goo.gl/ompgJ makeing it cross platform using Mono
>> and Gtk#. I've managed to make the newly written application run in Windows
>> and Linux, and just a few days ago we released an alpha version of it (
>> https://github.com/metageek-llc/inSSIDer-2-Cross-Platform - just the
>> binaries for now) and so far the responses have been awesome! I've met a guy
>> or two talking against it for using Mono but, to be honest, I give a sh**
>> about them.
>>
>> Now to the main point - to support the application so that it runs on Mac,
>> I need CoreWlan framework. I've successfully ran the program (without any
>> Network Scan support) on Mac and it looks super awesome! I wrote the
>> CoreWlan binding which is about 90% complete (see the attached corewlan.cs
>> file), and it compiled fine without any error. I'm pretty much sure only 90%
>> coverage should allow me to at least write a simple 'hello, corewlan'
>> program but I'm running out of luck. As soon as I call *NSApplication.Init
>> ()* and call my static method (*CWInterface.SupportedInterfaces()*, I get
>> a segfault error right away. If I call the static method without calling
>> *NSApplication.Init()*, I don't get any segfault but I always get a null
>> value instead of an array of string.
>>
>> I've noticed that when trying to invoke the static method (or any other
>> methods/ properties), the value of class_ptr is always 0x0.
>>
>> Here is the simple example that I'm using:
>>
>> *using System;*
>>
>> *using MonoMac.CoreWlan;*
>>
>> *namespace MacInssider*
>>
>> *{*
>>
>> * class MainClass*
>>
>> * {*
>>
>> * static void Main ()*
>>
>> *        {*
>>
>> *                    // NSApplication.Init(); // if I uncomment this out,
>> I get a segfault error right away*
>>
>> *       var interfaces = CWInterface.SupportedInterfaces();*
>>
>> *                     // interfaces is always null at this point.*
>>
>> *               }*
>>
>> * }*
>>
>> *}*
>>
>> My ultimate target is to get this example working using Mono (
>> http://goo.gl/YzEQy). Can anyone help me where I'm doing wrong? Or can
>> help me port CoreWlan framework?
>>
>> I've attached the corewlan.cs file and also all the generated .g.cs files
>> (I don't think attaching these .g files are required but just-in-case)
>>
>> Thanks,
>>
>> Ashok Gelal
>>
>>
>> _______________________________________________
>> 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/20110118/c8f307c5/attachment.html 


More information about the Mono-osx mailing list