[Mono-dev] P/Invoking libsmbclient from OSX

Robert Jordan robertj at gmx.net
Tue Dec 6 15:40:19 EST 2011


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



More information about the Mono-devel-list mailing list