[Issue 14533] Error 43: Not a Valid Library File

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 4 23:37:39 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14533

--- Comment #4 from donglei <dongl at putao.com> ---
(In reply to Richard Cattermole from comment #3)
> (In reply to donglei from comment #2)
> > (In reply to Richard Cattermole from comment #1)
> > > Just to confirm this is for 64bit builds on Windows? And not the default of
> > > 32bit?
> > 
> > Windows system is 64bit, but dmd is 32bit!
> > 
> > 
> > It maybe cased by COFF format, I want to convert it to OMF format, but not
> > found coffimplib in DMC website. 
> > 
> > Could you konw where i can find coffimplib. or where can I download
> > libmysql.lib for dlang
> > 
> > Thanks!
> 
> Assuming you are building for 32bit on Windows then you will be using OMF.
> coffimplib is available at http://ftp.digitalmars.com/coffimplib.zip


It solved in windows,

but in debian 
pragma (lib, "mysqlclient");
extern(System) {
    struct MYSQL;
    struct MYSQL_RES;
    /* typedef */ alias const(ubyte)* cstring;

    struct MYSQL_FIELD {
          cstring name;                 /* Name of column */
          cstring org_name;             /* Original column name, if an alias */ 
          cstring table;                /* Table of column if column was a
field */
          cstring org_table;            /* Org table name, if table was an
alias */
          cstring db;                   /* Database for table */
          cstring catalog;          /* Catalog for table */
          cstring def;                  /* Default value (set by
mysql_list_fields) */
          uint length;       /* Width of column (create length) */
          uint max_length;   /* Max width for selected set */
          uint name_length;
          uint org_name_length;
          uint table_length;
          uint org_table_length;
          uint db_length;
          uint catalog_length;
          uint def_length;
          uint flags;         /* Div flags */
          uint decimals;      /* Number of decimals in field */
          uint charsetnr;     /* Character set */
          uint type; /* Type of field. See mysql_com.h for types */
          // type is actually an enum btw

        version(MySQL_51) {
            void* extension;
        }
    }

    /* typedef */ alias cstring* MYSQL_ROW;

    cstring mysql_get_client_info();
    MYSQL* mysql_init(MYSQL*);
    uint mysql_errno(MYSQL*);
    cstring mysql_error(MYSQL*);

    MYSQL* mysql_real_connect(MYSQL*, cstring, cstring, cstring, cstring, uint,
cstring, c_ulong);

    int mysql_query(MYSQL*, cstring);

    void mysql_close(MYSQL*);

    ulong mysql_num_rows(MYSQL_RES*);
    uint mysql_num_fields(MYSQL_RES*);
    bool mysql_eof(MYSQL_RES*);

    ulong mysql_affected_rows(MYSQL*);
    ulong mysql_insert_id(MYSQL*);

    MYSQL_RES* mysql_store_result(MYSQL*);
    MYSQL_RES* mysql_use_result(MYSQL*);

    MYSQL_ROW mysql_fetch_row(MYSQL_RES *);
    uint* mysql_fetch_lengths(MYSQL_RES*);
    MYSQL_FIELD* mysql_fetch_field(MYSQL_RES*);
    MYSQL_FIELD* mysql_fetch_fields(MYSQL_RES*);

    uint mysql_real_escape_string(MYSQL*, ubyte* to, cstring from, uint
length);

    void mysql_free_result(MYSQL_RES*);

}
It does work

Thanks

--


More information about the Digitalmars-d-bugs mailing list