none
Using an external dll to build a Sensor and Location driver RRS feed

  • Question

  • Hi,

    I am using SensorSkeleton to build my own driver.

    I am having difficulties to build it importing my own library (developed with Visual C++) into my driver.

    This library exports a very simple function and generates MyLIB.lib (debbuging with Visual C++)
    #define DLL_EXPORT extern "C" __declspec(dllexport)
    DLL_EXPORT int ReturnAnInteger();
    
    int ReturnAnInteger()
    {
        return 1;
    }
    

    In my sensor side, I added the .lib in the sources file as below:

    TARGETLIBS=\
        $(SDK_LIB_PATH)\strsafe.lib   \
        $(SDK_LIB_PATH)\kernel32.lib  \
        $(SDK_LIB_PATH)\ole32.lib    \
        $(SDK_LIB_PATH)\oleaut32.lib  \
        $(SDK_LIB_PATH)\uuid.lib    \
        $(SDK_LIB_PATH)\user32.lib   \
        $(SDK_LIB_PATH)\advapi32.lib  \
        $(SDK_LIB_PATH)\shlwapi.lib   \
        $(SDK_LIB_PATH)\PortableDeviceGuids.lib \
        $(DDK_LIB_PATH)\SensorsClassExtension.lib \
    	MyLIB.lib \

    In the SensorDdi.cpp I want to call ReturnAnInteger() function.

    I tried importing this function:

    extern "C"{__declspec(dllimport) int ReturnAnInteger();}
    

    It compiles without a problem. But when I call this function, the compiler gives an error:

    "... error LNK2001: unresolved external symbol __imp_ReturnAnInteger "

    I'm using WDK build compiler.

    I really appreciate it any help!

    Thanks

    Rafael
     
    Wednesday, June 29, 2011 9:43 PM