Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » DLL build gives undef-referenced function error(Building a DLL using MinGW that uses a function from another DLL gives undef reference)
DLL build gives undef-referenced function error [message #1736945] Mon, 04 July 2016 14:09
Robert kinchin is currently offline Robert kinchinFriend
Messages: 1
Registered: July 2016
Junior Member
I am using eclipse and minGW to compile a DLL that is to be used as a wrapper DLL for Labview. The current DLL I have inherited was built from mathlab and contains a function with a complex call parameters that labview cannot resolve.
I have created a wrapper function that simplified the call parameters and then calls the function that resides in the original DLL and similarly simplifies the return data..

However I cannot create the wrapper DLL as it complains that the call to the function in the original DLL cannot be referenced (not surprising as I probably doesn't know it exists).

What I cant see is how to make the DLL linker know about the original DLL.

I hope that makes sense.
Any one can point me in the right direction please
below is the code.
RFID_RetrieveAttachedRadiosListWapper() is my wrapper functions
RFID_RetrieveAttachedRadiosList() exists in a DLL (rfid.dll)

Note these DLL's are not used by windows, but will be later imported into labview

/*
 * xxx.c
 *
 *  Created on: 1 Jul 2016
 *      Author: ROBERT
 */
/*
 ============================================================================
 Name        : labviewWrapper.c
 Author      : Robert Kinchin
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdint.h>
typedef signed      INT8S;
typedef unsigned     INT8U;
typedef signed       INT16S;
typedef unsigned     INT16U;
typedef signed       INT32S;
typedef unsigned     INT32U;
typedef signed       INT64S;
typedef unsigned     INT64U;
typedef signed       BOOL32;
typedef unsigned 	HANDLE32;
typedef unsigned 	HANDLE64;

typedef struct {
    /* The major version (i.e, in 1.x.x.x, the 1)                               */
	INT32U  major;
    /* The minor version (i.e., in x.1.x.x, the 1)                              */
    INT32U  minor;
    /* The maintenance number (i.e., in x.x.1.x, the 1)                          */
    INT32U  maintenance;
    /* The release number (i.e., in x.x.x.1, the 1)                             */
    INT32U  release;
} RFID_VERSION;


typedef struct {
    /* The length of the structure in bytes.  This will be                    */
    /* sizeof(RFID_RADIO_INFO).                                               */
    INT32U          length;
     /* The version information for the radio's bus driver.                   */
    RFID_VERSION    driverVersion;
    /* The unique cookie for the radio.  This cookie is passed to             */
    /* RFID_RadioOpen() when the application wishes to take control of the    */
    /* radio.                                                                 */
    INT32U          cookie;
    /* The length, in bytes, of the uniqueId field(aka, serial number)        */
    /* including the null terminator                                          */
    INT32U          idLength;
    /* A pointer to an array of bytes that contain the radio module's unique  */
    /* ID (aka, serial number).                                               */
    INT8U*          pUniqueId;
} RFID_RADIO_INFO;
/******************************************************************************
 * Name:  RFID_RADIO_ENUM - The data that will be returned from a request to
 *        list the radios that are attached to the system.
 ******************************************************************************/
typedef struct {
    /* The length of the structure in bytes.  The application must set this to*/
    /* sizeof(RFID_RADIO_ENUM) before calling                                 */
    /* RFID_RetrieveAttachedRadiosList().                                     */
    INT32U              length;
    /* The total length, in bytes, of radio enumeration structure.  The       */
    /* application must fill in this field with the length of the radio       */
    /* enumeration buffer before calling RFID_RetrieveAttachedRadiosList().   */
    /* If the buffer is not large enough, on return this field contains the   */
    /* required size of the radio-enumeration buffer.  If the buffer is large */
    /* enough, on return this field contains the number of bytes returned     */
    INT32U              totalLength;
    /* The number of radios that are attached to the system.  This is also the*/
    /* number of radio info structure pointers in the array pointed to by     */
    /* ppRadioInfo.                                                           */
    INT32U              countRadios;
    /* A pointer to an array of RFID_RADIO_INFO structure pointers.  The array*/
    /* contains countRadios entries.                                          */
    RFID_RADIO_INFO**   ppRadioInfo;
} RFID_RADIO_ENUM;

enum
{
    /* Success                                                                */
    RFID_STATUS_OK,
    /* Attempted to open a radio that is already open                         */
    RFID_ERROR_ALREADY_OPEN     = -9999,                             /* -9999 */
    /* Buffer supplied is too small                                           */
    RFID_ERROR_BUFFER_TOO_SMALL,                                     /* -9998 */
    /* General failure                                                        */
    RFID_ERROR_FAILURE,                                              /* -9997 */
    /* Failed to load radio bus driver                                        */
    RFID_ERROR_DRIVER_LOAD,                                          /* -9996 */
    /* Library cannot use version of radio bus driver present on system       */
    RFID_ERROR_DRIVER_MISMATCH,                                      /* -9995 */
    /* This error code is no longer used, maintain slot in enum in case		  */
    /* anyone is using hard-coded error codes for some reason                 */
    RFID_ERROR_RESERVED_01,                                          /* -9994 */
    /* Antenna number is invalid                                              */
    RFID_ERROR_INVALID_ANTENNA,                                      /* -9993 */
    /* Radio handle provided is invalid                                       */
    RFID_ERROR_INVALID_HANDLE,                                       /* -9992 */
    /* One of the parameters to the function is invalid                       */
    RFID_ERROR_INVALID_PARAMETER,                                    /* -9991 */
    /* Attempted to open a non-existent radio                                 */
    RFID_ERROR_NO_SUCH_RADIO,                                        /* -9990 */
    /* Library has not been successfully initialized                          */
    RFID_ERROR_NOT_INITIALIZED,                                      /* -9989 */
    /* Function not supported                                                 */
    RFID_ERROR_NOT_SUPPORTED,                                        /* -9988 */
    /* Operation was cancelled by call to cancel operation, close radio, or   */
    /* shut down the library                                                  */
    RFID_ERROR_OPERATION_CANCELLED,                                  /* -9987 */
    /* Library encountered an error allocating memory                         */
    RFID_ERROR_OUT_OF_MEMORY,                                        /* -9986 */
    /* The operation cannot be performed because the radio is currently busy  */
    RFID_ERROR_RADIO_BUSY,                                           /* -9985 */
    /* The underlying radio module encountered an error                       */
    RFID_ERROR_RADIO_FAILURE,                                        /* -9984 */
    /* The radio has been detached from the system                            */
    RFID_ERROR_RADIO_NOT_PRESENT,                                    /* -9983 */
    /* The RFID library function is not allowed at this time.                 */
    RFID_ERROR_CURRENTLY_NOT_ALLOWED,                                /* -9982 */
    /* The radio module's MAC firmware is not responding to requests.         */
    RFID_ERROR_RADIO_NOT_RESPONDING,                                 /* -9981 */
    /* The MAC firmware encountered an error while initiating the nonvolatile */
    /* memory update.  The MAC firmware will return to its normal idle state  */
    /* without resetting the radio module.                                    */
    RFID_ERROR_NONVOLATILE_INIT_FAILED,                              /* -9980 */
    /* An attempt was made to write data to an address that is not in the     */
    /* valid range of radio module nonvolatile memory addresses.              */
    RFID_ERROR_NONVOLATILE_OUT_OF_BOUNDS,                            /* -9979 */
    /* The MAC firmware encountered an error while trying to write to the     */
    /* radio module's nonvolatile memory region.                              */
    RFID_ERROR_NONVOLATILE_WRITE_FAILED,                             /* -9978 */
    /* The underlying transport layer detected that there was an overflow     */
    /* error resulting in one or more bytes of the incoming data being        */
    /* dropped.  The operation was aborted and all data in the pipeline was   */
    /* flushed.                                                               */
    RFID_ERROR_RECEIVE_OVERFLOW,                                     /* -9977 */
    /* An unexpected value was returned to this function by the MAC firmware  */
    RFID_ERROR_UNEXPECTED_VALUE,                                     /* -9976 */
    /* The MAC firmware encountered CRC errors while trying to                */
    /* write to the radio module's nonvolatile memory region.                 */
    RFID_ERROR_NONVOLATILE_CRC_FAILED,                               /* -9975 */
    /* The MAC firmware encountered unexpected values in the packet header    */
    RFID_ERROR_NONVOLATILE_PACKET_HEADER,                            /* -9974 */
    /* The MAC firmware received more than the specified maximum packet size  */
    RFID_ERROR_NONVOLATILE_MAX_PACKET_LENGTH                         /* -9973 */
};
typedef INT32S  RFID_STATUS;

#define RFID_LIBRARY_API __declspec(dllimport)
#define RFID_WRAPPER_API __declspec(dllexport)

RFID_LIBRARY_API RFID_STATUS RFID_RetrieveAttachedRadiosList(RFID_RADIO_ENUM *pBuffer,INT32U flags);

typedef struct {

    INT32U              length;
    /* The total length, in bytes, of radio enumeration structure.  The       */
    /* application must fill in this field with the length of the radio       */
    /* enumeration buffer before calling RFID_RetrieveAttachedRadiosList().   */
    /* If the buffer is not large enough, on return this field contains the   */
    /* required size of the radio-enumeration buffer.  If the buffer is large */
    /* enough, on return this field contains the number of bytes returned     */
    INT32U              totalLength;
    /* The number of radios that are attached to the system.  This is also the*/
    /* number of radio info structure pointers in the array pointed to by     */
    /* ppRadioInfo.                                                           */
    INT32U              countRadios;
    /* A pointer to an array of RFID_RADIO_INFO structure pointers.  The array*/
    /* contains countRadios entries.                                          */
    INT32U          ilength;
     /* The version information for the radio's bus driver.                   */
    RFID_VERSION    driverVersion;
    /* The unique cookie for the radio.  This cookie is passed to             */
    /* RFID_RadioOpen() when the application wishes to take control of the    */
    /* radio.                                                                 */
    INT32U          cookie;
    /* The length, in bytes, of the uniqueId field(aka, serial number)        */
    /* including the null terminator                                          */
    INT32U          idLength;
    /* A pointer to an array of bytes that contain the radio module's unique  */
    /* ID (aka, serial number).                                               */
    INT8U          	UniqueId;
}RFID_RADIO_ENUM_WP;

RFID_WRAPPER_API RFID_STATUS RFID_RetrieveAttachedRadiosListWapper(
    RFID_RADIO_ENUM_WP* pWBuffer,
    INT32U              flags
    )
{
	RFID_RADIO_ENUM Buffer;
	RFID_RADIO_ENUM *pBuffer;
	RFID_RADIO_INFO Info;
	RFID_RADIO_INFO *pInfo;
	RFID_STATUS status;

	Info.length = pWBuffer->ilength;
	Info.driverVersion = pWBuffer->driverVersion;
	Info.cookie = pWBuffer->cookie;
	Info.idLength = pWBuffer->idLength;
	Info.pUniqueId = &(pWBuffer->UniqueId);
	pInfo = &Info;

	pBuffer = &Buffer;
	pBuffer->length = pWBuffer->length;
	pBuffer->totalLength = pWBuffer->totalLength;
	pBuffer->countRadios = pWBuffer->countRadios;
	pBuffer->ppRadioInfo = &pInfo;

	status = RFID_RetrieveAttachedRadiosList(pBuffer,flags);
	pInfo = *(pBuffer->ppRadioInfo);

	pWBuffer->length = pBuffer->length;
	pWBuffer->totalLength = pBuffer->totalLength;
	pWBuffer->countRadios = pBuffer->countRadios;
	pWBuffer->driverVersion = pInfo->driverVersion;
	pWBuffer->cookie = pInfo->cookie;
	pWBuffer->idLength = pInfo->idLength;
	pWBuffer->UniqueId = *(pInfo->pUniqueId);


	return(status);
}

/*RFID_LIBRARY_API RFID_STATUS RFID_RetrieveAttachedRadiosList(RFID_RADIO_ENUM *pBuffer,INT32U flags)
{
	return(RFID_STATUS_OK);
}*/



Robert
Previous Topic:Linkercall fails because of Windowslimit
Next Topic:unresolved external during link
Goto Forum:
  


Current Time: Tue Mar 19 10:06:30 GMT 2024

Powered by FUDForum. Page generated in 0.01886 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top