[Mono-dev] P/Invoking libsmbclient from OSX
Alan
alan.mcgovern at gmail.com
Wed Dec 7 06:15:45 EST 2011
I worked through the problem with him yesterday and simply p/invoking a
single native function of the form: "int smb_init (int value)" is enough
to make it crash.
The most likely issue I can think of is that there is a symbol clash which
is causing libsmb to invoke a mono function instead of it's own which then
causes things to blow up. It's unlikely to be a calling convention related
problem because the stack never unwinds and it does successfully call a
bunch of functions and then blows up a dozen or two frames deep. Other than
that, there's very little that could possibly go wrong.
Alan
On 6 December 2011 23:11, Alfred Hall <ahall at ahall.org> wrote:
> Hi,
>
> This may explain why smbc_init blows up, but does not explain why
> smbc_init2() blows up. In smbc_init2()
> the callback is in the unmanaged code. It still blows up.
>
> Cheers,
> Alfred
>
> On Tue, Dec 6, 2011 at 8:40 PM, Robert Jordan <robertj at gmx.net> wrote:
> > Hi,
> >
> > On 06.12.2011 20:53, Alfred Hall wrote:
> >> Good afternoon!
> >>
> >> I have been trying to P/Invoke into libsmbclient on OSX 10.6 running
> >> 64 bit kernel. I compile the samba library myself (version 3.6.0) with
> >> -m32 and managed to get a simple stub working in C/C++:
> >>
> >> static void
> >> auth_fn(const char *server, const char *share,
> >> char *workgroup, int wgmaxlen, char *username, int unmaxlen,
> >> char *password, int pwmaxlen)
> >> {
> >> }
> >>
> >> smbc_init(auth_fn, 10);
> >> smbc_opendir("smb://myuser:mypass@192.168.x.x/c$");
> >>
> >> This works fine, then I created the P/Invokes:
> >>
> >> public static void SmbInit()
> >> {
> >> smbc_init(CallBackAuth, 0);
> >
> > You must pin the delegate passed to smbc_init, either using
> > a field or a GCHandle.
> >
> > Robert
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20111207/0bb6d32b/attachment-0001.html
More information about the Mono-devel-list
mailing list