[Mono-dev] P/Invoking libsmbclient from OSX

Alfred Hall ahall at ahall.org
Tue Dec 6 18:11:31 EST 2011


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
>


More information about the Mono-devel-list mailing list