LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Warning: Creating a DLL with no exports. No import libraries will be created.

I'm declaring my functions like this:

int __declspec( dllexport ) MyFunction(void);

yet I still get that "Creating a DLL with no exports" message. What could be going wrong?
0 Kudos
Message 1 of 7
(8,324 Views)
You need to export the function prototypes to a header file. Open the sourcefile in CVI, and from the Build menu, select Generate Prototypes. If this menu item is not available, select Build-->Compile first.

Add the file to your project

In the Project window select Build-->Target Settings you should see the functions under exports, if not select the ones you want to export!
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 2 of 7
(8,326 Views)
I create a separate .h file for functions that I want to export. I copy all prototypes for functions to be exported into one .h file. I copy (and modify) the prototypes: I don't move them. I leave the original prototypes in their original .h or .c file. I don't #include the new .h file in any .c or .h file to generate the DLL file: I only #include that file in the apps that call the DLL file. I name the new .h file with the suffix _DllExports.
For example, I have a project named MyDLL. In it, I have files named MyDll.c, MyDll.h, MyUtils.c, MyUtils.h.
I have two functions I want to export: MyDll_Init and MyDll_RunCommand.
I create a new .h file MyDll_DllExports.h.
The prototype for MyDll_Init is in MyUtils.h
int MyDll_Init(int bUseCviUI);
I copy the prototyp
e to MyDll_DllExports.h and modify it to:
extern int __cdecl MyDll_Init(int bUseCviUI);
The prototype for MyDll_RunCommand is in MyDll.c
int MyDll_RunCommand(char *sCommand);
I copy the prototype to MyDll_DllExports.h and modify it to:
extern int __cdecl MyDll_RunCommand(char *sCommand);
I leave the original prototypes unmodified in their original locations.
I add MyDll_DllExports.h to my project (but don't #include it in any of my .c or .h files): from the project window goto Edit >> Add Files to Project >> Include (*.h)
I set MyDll_DllExports.h to be exported: from the project window, goto Build >> Target settings >> Change (in the Exports box), then select MyDll_DllExports.h.
Then I build.
Just a side note:
It's easy to debug a DLL:
Create an application that calls the function you want to debug.
Open the DLL application.
In the project window, goto Run >> Select External Process, and enter the path to the exe that calls your DLL.
Goto Run >> Debug (yourexe).exe
Message 3 of 7
(8,324 Views)
I am also getting the same error message even after generating prototypes.  There must be something missing from the C file or the prototypes since I still get the message "Creating a DLL with no exports".

#include "stdtst.h"
#include "tsutil.h"
#include "SerialNumberTest.h"

int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
        {
        case DLL_PROCESS_ATTACH:
            if (InitCVIRTE (hinstDLL, 0, 0) == 0)
                return 0;      /* out of memory */
            break;
        case DLL_PROCESS_DETACH:
            CloseCVIRTE ();
            break;
        }
   
    return 1;
}

int __stdcall DllEntryPoint (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    /* Included for compatibility with Borland */
    return DllMain (hinstDLL, fdwReason, lpvReserved);
}

void __declspec(dllexport) TX_TEST TS_SerialNumber1(tTestData *testData, tTestError *testError)
{
    return;   
}

This is the header file after CVI generated the prototypes.

/************** Static Function Declarations **************/

/************** Global Variable Declarations **************/

/************** Global Function Declarations **************/
extern void  __declspec(dllexport) __cdecl TS_SerialNumber1(tTestData *testData,
                        tTestError *testError);
extern int __stdcall DllMain(HINSTANCE hinstDLL,
                             DWORD fdwReason, LPVOID lpvReserved);
extern int __stdcall DllEntryPoint(HINSTANCE hinstDLL,
                                   DWORD fdwReason, LPVOID lpvReserved);



John Bessire







0 Kudos
Message 4 of 7
(8,125 Views)

We are having this problem as well...we have a VXI-DIO-128 board and we are attempting to move to XP from 95.  We had a custom wrapper we wrote that when we attempt to compile it in CVI we get this issue.

I did finally get the thing to compile by putting into my .h file prototypes for all the functions with _declspec(dllexport) but then when I load the dll in HTBasic it shows up as empty - it has no functions listed.

 

Anyone have any ideas?

0 Kudos
Message 5 of 7
(7,560 Views)
Hello,

Are you able to see the functions in the dll if you use a program such as Dependency Walker? If you go to Build>>Target Settings and then click the Change button at the bottom of this window, are you exporting Include file symbols, symbols marked for export, or both?  This dialog from the Target Settings dialog allows you to have control over which functions will be exported, whether they have been marked with dllexport, are in some header file, or a combination of two. 

NickB
National Instruments
Applications Engineering
Message 6 of 7
(7,535 Views)

your method is right,thank you

0 Kudos
Message 7 of 7
(5,999 Views)