Wally ha scritto: > Do anybody have (or know where to find) an example code > using an external function call to a shared library. > (e.g. a math lib or something common) > Just an excerpt from a ldap module, which interfaces with libldapxxx:
LIBRARY "libldap:2" ' to initialize the ldap client library PRIVATE EXTERN ldap_init(host AS String, port AS Integer) AS Pointer ' to bind (login) into the ldap server PRIVATE EXTERN ldap_simple_bind_s(ldconn AS Pointer, who AS String, passwd AS String) AS Integer ' to unbind *and* terminate PRIVATE EXTERN ldap_unbind(ldconn AS Pointer) AS Integer ' to provide useful text messages for errors PRIVATE EXTERN ldap_err2string(err AS Integer) AS Pointer ' ? PRIVATE EXTERN ldap_result2error(ldconn AS Pointer, PLDAPMessage AS Pointer, freeit AS Integer) AS Integer ' the search function to get results PRIVATE EXTERN ldap_search_s(ldconn AS Pointer, base AS String, scope AS Integer, filter AS String, attrs AS Pointer, attrsonly AS Integer, res AS Pointer) AS Integer ' they were: LDAP* ld; char* base; Int scope; char* filter, *attrs[], Int attrsonly; LDAPMessage** res; The ldap_init() is called this way: PUBLIC SUB _new(host AS String) max_results = 100 conn = ldap_init(host, 389) IF conn = NULL THEN error.Raise("Can not init ldap library") The ldap_simple_bind() is called this way: PUBLIC SUB bind(who AS String, passwd AS String) AS Integer DIM res AS Integer ldap_bounded = FALSE res = ldap_simple_bind_s(conn, who, passwd) lasterr = StrPtr(ldap_err2string(res)) IF res = 0 THEN ' anonymous bind? IF who <> "" THEN ldap_bounded = TRUE ENDIF RETURN res END -- Doriano Blengino "Listen twice before you speak. This is why we have two ears, but only one mouth." ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user