Interfacing with C in 2.066.1

Jason den Dulk via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 8 03:54:41 PST 2014


On Saturday, 8 November 2014 at 10:52:16 UTC, Gary Willoughby 
wrote:

> const(char)* foo()

This fixed the const issue. Thanks for that guys.

> Have you got an example of the struct giving you problems?

struct st_mysql_res {
   my_ulonglong  row_count;
   MYSQL_FIELD	*fields;
   MYSQL_DATA	*data;
   MYSQL_ROWS	*data_cursor;
   ulong *lengths;		/* column lengths of current row */
   MYSQL		*handle;		/* for unbuffered reads */
   st_mysql_methods *methods;
   MYSQL_ROW	row;			/* If unbuffered read */
   MYSQL_ROW	current_row;		/* buffer to current row */
   MEM_ROOT	field_alloc;
   uint	field_count, current_field;
   my_bool	eof;			/* Used by mysql_fetch_row */
   /* mysql_stmt_close() had to cancel this result */
   my_bool       unbuffered_fetch_cancelled;
   void *extension;
}

The struct is never instantised anywhere. It is always referenced 
by pointer.

The error message is:
undefined reference to 
`_D6jaypha5dbsql5mysql1c5mysql12st_mysql_res6__initZ'

A search of the raw object file generated produces the above 
reference, however when disassembling the file, it disappears. 
Not sure what the significance of that is.


More information about the Digitalmars-d mailing list