зеркало из https://github.com/mono/mail-archives.git
199 строки
8.6 KiB
HTML
199 строки
8.6 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE> [Mono-osx] CoreWlan Framework binding problem
|
||
|
</TITLE>
|
||
|
<LINK REL="Index" HREF="index.html" >
|
||
|
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20CoreWlan%20Framework%20binding%20problem&In-Reply-To=AANLkTinRbDVykoxNYJgbt%2B1jL%2BHqFasjnBb_roLpGAU5%40mail.gmail.com">
|
||
|
<META NAME="robots" CONTENT="index,nofollow">
|
||
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
||
|
<LINK REL="Previous" HREF="003692.html">
|
||
|
<LINK REL="Next" HREF="003721.html">
|
||
|
</HEAD>
|
||
|
<BODY BGCOLOR="#ffffff">
|
||
|
<H1>[Mono-osx] CoreWlan Framework binding problem</H1>
|
||
|
<B>Duane Wandless</B>
|
||
|
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20CoreWlan%20Framework%20binding%20problem&In-Reply-To=AANLkTinRbDVykoxNYJgbt%2B1jL%2BHqFasjnBb_roLpGAU5%40mail.gmail.com"
|
||
|
TITLE="[Mono-osx] CoreWlan Framework binding problem">duane at wandless.net
|
||
|
</A><BR>
|
||
|
<I>Tue Jan 18 15:34:38 EST 2011</I>
|
||
|
<P><UL>
|
||
|
<LI>Previous message: <A HREF="003692.html">[Mono-osx] CoreWlan Framework binding problem
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="003721.html">[Mono-osx] CoreWlan Framework binding problem
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#3693">[ date ]</a>
|
||
|
<a href="thread.html#3693">[ thread ]</a>
|
||
|
<a href="subject.html#3693">[ subject ]</a>
|
||
|
<a href="author.html#3693">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
<HR>
|
||
|
<!--beginarticle-->
|
||
|
<PRE>The MonoMac library does not know that you need the CoreWLAN dynamic library
|
||
|
to be loaded so it is not. MM has code for loading the standard dynamic
|
||
|
libraries. In order for the bindings for CoreWLAN to work this library must
|
||
|
be loaded prior to MM's initialization.
|
||
|
|
||
|
Duane
|
||
|
|
||
|
On Tue, Jan 18, 2011 at 3:15 PM, Ashok Gelal <<A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">ashokgelal at gmail.com</A>> wrote:
|
||
|
|
||
|
><i> Awesome! That's seems to work. But can you please explain why I need to
|
||
|
</I>><i> call the following:
|
||
|
</I>><i>
|
||
|
</I>><i> dlopen("/System/Library/Frameworks/CoreWLAN.framework/CoreWLAN", 0);
|
||
|
</I>><i>
|
||
|
</I>><i> Thanks again. When I get some free time, I will rewrite the CoreWlan sample
|
||
|
</I>><i> and will ask someone on git to pull it.
|
||
|
</I>><i>
|
||
|
</I>><i> ashok
|
||
|
</I>><i>
|
||
|
</I>><i> On Mon, Jan 17, 2011 at 8:28 AM, Duane Wandless <<A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">duane at wandless.net</A>>wrote:
|
||
|
</I>><i>
|
||
|
</I>>><i> Try something like this:
|
||
|
</I>>><i>
|
||
|
</I>>><i> [System.Runtime.InteropServices.DllImport ("/usr/lib/libSystem.dylib")]
|
||
|
</I>>><i> public static extern IntPtr dlopen (string path, int mode);
|
||
|
</I>>><i> [System.Runtime.InteropServices.DllImport("/usr/lib/libSystem.dylib")]
|
||
|
</I>>><i> public static extern string dlerror(); static void Main (string[] args) {
|
||
|
</I>>><i> dlopen("/System/Library/Frameworks/CoreWLAN.framework/CoreWLAN", 0);
|
||
|
</I>>><i> Console.WriteLine("load error = {0}", dlerror()); NSApplication.Init ();
|
||
|
</I>>><i> var interfaces = CWInterface.SupportedInterfaces();
|
||
|
</I>>><i> NSApplication.Main (args);
|
||
|
</I>>><i> }
|
||
|
</I>>><i>
|
||
|
</I>>><i> Duane
|
||
|
</I>>><i>
|
||
|
</I>>><i>
|
||
|
</I>>><i>
|
||
|
</I>>><i> On Sun, Jan 16, 2011 at 11:26 PM, Ashok Gelal <<A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">ashokgelal at gmail.com</A>>wrote:
|
||
|
</I>>><i>
|
||
|
</I>>>><i> Hello All,
|
||
|
</I>>>><i> Right now I'm working on rewriting a popular open source software
|
||
|
</I>>>><i> inSSIDEr from MetaGeek <A HREF="http://goo.gl/ompgJ">http://goo.gl/ompgJ</A> makeing it cross platform
|
||
|
</I>>>><i> using Mono and Gtk#. I've managed to make the newly written application run
|
||
|
</I>>>><i> in Windows and Linux, and just a few days ago we released an alpha version
|
||
|
</I>>>><i> of it (<A HREF="https://github.com/metageek-llc/inSSIDer-2-Cross-Platform">https://github.com/metageek-llc/inSSIDer-2-Cross-Platform</A> - just
|
||
|
</I>>>><i> the binaries for now) and so far the responses have been awesome! I've met a
|
||
|
</I>>>><i> guy or two talking against it for using Mono but, to be honest, I give a
|
||
|
</I>>>><i> sh** about them.
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> Now to the main point - to support the application so that it runs on
|
||
|
</I>>>><i> Mac, I need CoreWlan framework. I've successfully ran the program (without
|
||
|
</I>>>><i> any Network Scan support) on Mac and it looks super awesome! I wrote the
|
||
|
</I>>>><i> CoreWlan binding which is about 90% complete (see the attached corewlan.cs
|
||
|
</I>>>><i> file), and it compiled fine without any error. I'm pretty much sure only 90%
|
||
|
</I>>>><i> coverage should allow me to at least write a simple 'hello, corewlan'
|
||
|
</I>>>><i> program but I'm running out of luck. As soon as I call *NSApplication.Init
|
||
|
</I>>>><i> ()* and call my static method (*CWInterface.SupportedInterfaces()*, I
|
||
|
</I>>>><i> get a segfault error right away. If I call the static method without calling
|
||
|
</I>>>><i> *NSApplication.Init()*, I don't get any segfault but I always get a null
|
||
|
</I>>>><i> value instead of an array of string.
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> I've noticed that when trying to invoke the static method (or any other
|
||
|
</I>>>><i> methods/ properties), the value of class_ptr is always 0x0.
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> Here is the simple example that I'm using:
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> *using System;*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> *using MonoMac.CoreWlan;*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> *namespace MacInssider*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> *{*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> * class MainClass*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> * {*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> * static void Main ()*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> * {*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> * // NSApplication.Init(); // if I uncomment this
|
||
|
</I>>>><i> out, I get a segfault error right away*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> * var interfaces = CWInterface.SupportedInterfaces();*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> * // interfaces is always null at this point.*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> * }*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> * }*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> *}*
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> My ultimate target is to get this example working using Mono (
|
||
|
</I>>>><i> <A HREF="http://goo.gl/YzEQy">http://goo.gl/YzEQy</A>). Can anyone help me where I'm doing wrong? Or can
|
||
|
</I>>>><i> help me port CoreWlan framework?
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> I've attached the corewlan.cs file and also all the generated .g.cs files
|
||
|
</I>>>><i> (I don't think attaching these .g files are required but just-in-case)
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> Thanks,
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> Ashok Gelal
|
||
|
</I>>>><i>
|
||
|
</I>>>><i>
|
||
|
</I>>>><i> _______________________________________________
|
||
|
</I>>>><i> Mono-osx mailing list
|
||
|
</I>>>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">Mono-osx at lists.ximian.com</A>
|
||
|
</I>>>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">http://lists.ximian.com/mailman/listinfo/mono-osx</A>
|
||
|
</I>>>><i>
|
||
|
</I>>>><i>
|
||
|
</I>>><i>
|
||
|
</I>><i>
|
||
|
</I>-------------- next part --------------
|
||
|
An HTML attachment was scrubbed...
|
||
|
URL: <A HREF="http://lists.ximian.com/pipermail/mono-osx/attachments/20110118/eb0f379d/attachment-0001.html">http://lists.ximian.com/pipermail/mono-osx/attachments/20110118/eb0f379d/attachment-0001.html</A>
|
||
|
</PRE>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<!--endarticle-->
|
||
|
<HR>
|
||
|
<P><UL>
|
||
|
<!--threads-->
|
||
|
<LI>Previous message: <A HREF="003692.html">[Mono-osx] CoreWlan Framework binding problem
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="003721.html">[Mono-osx] CoreWlan Framework binding problem
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#3693">[ date ]</a>
|
||
|
<a href="thread.html#3693">[ thread ]</a>
|
||
|
<a href="subject.html#3693">[ subject ]</a>
|
||
|
<a href="author.html#3693">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
|
||
|
<hr>
|
||
|
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
|
||
|
mailing list</a><br>
|
||
|
</body></html>
|