04-14-2011 01:26 PM
The problem is simple I guess:
I have made a program that calls a DLL; in the call dll function node I havent even specified a path to the DLL, just the name (flowb32.dll).
I think its on my PC somewhere, so it works on my pc. When I build an installer and distribute the customer gets an error trying to install, saying the dlls are missing.
I have tried including the dll (there are some others needed too) in the root, putting them in the system folder or in the windows\system32 folder through the installer
that Im making, but it is a no go. I am obviously overlooking something; some help is appreciated!
04-20-2011 06:12 AM - edited 04-20-2011 06:12 AM
Hi,
1) you have to specify the path when you call the dll
2) in the installer, you have to make a rule to copy the dll to the good path.
I hope it will solve your problem
Best regards,
04-20-2011 07:46 AM - edited 04-20-2011 07:50 AM
Well since you say there are more than one DLL anyhow, you should have an installer for that DLL and its supporting libraries. There is a good chance that some of them are not just simple DLLs, but either ActiveX or .Net libraries and they do need either registration (ActiveX) or be put in specific places (.Net) for Windows to be able to load them. So it's best to tell the customer to run that seperate installer before trying to run your application.
Including DLLs into an application build is only a good idea, if those DLLs are fully self contained (with the exception of standard OS calls of course) and are not part of an ActiveX or .Net suite.
Basically, unless the DLL is fully self contained or you have written the DLL and know exactly about its specific needs and what to install in addition and where, you should never include DLLs into an application build. Instead there should be a seperate installer that is run, and you only link to those DLLs without specifying any path, so Windows will pick them up from whereever the DLL installer put them.
01-16-2015 07:09 AM
Hi everyone..
I m trying to control EL-FLOW meter/controller by using CVI LabWindows. I want to use the funtions in the library Flowb32.dll
I can´t use the funtion,
Can someone give me a example, how to call the funtions at the library?
I have done ...
//==============================================================================
//==============================================================================
//==============================================================================
//
// Title: FlowCVI
// Purpose: A short description of the application.
//
// Created on: 16/01/2015 at 11:48:24 by Jose Manuel Caicedo Roque.
// Copyright: ICN. All Rights Reserved.
//
//==============================================================================
//==============================================================================
// Include files
#include <windows.h> //For functions: LoadLibrary, FreeLibrary and GetProcAddress
#include <ansi_c.h>
#include <cvirte.h>
#include <userint.h>
#include "FlowCVI.h"
#include "toolbox.h"
#include <stdio.h> //For printf (print to console)
//==============================================================================
//==============================================================================
//==============================================================================
// Constants
char pszPortName[20];
//==============================================================================
//==============================================================================
//==============================================================================
// Types
/*
Declare a pointer to a function which returns a short and takes a long
as parameter. The name of the type will be _OpenDLL
*/
typedef short (__stdcall * _OpenDLL)(long lHwnd);
//==============================================================================
//==============================================================================
//==============================================================================
// Static global variables
static int panelHandle;
//*Declare a variable to hold the lib-handle*/
HMODULE hLibHandle;
/*Declare a variable to hold the function pointer*/
_OpenDLL OpenDLL;
//==============================================================================
//==============================================================================
//==============================================================================
// Static functions
//==============================================================================
//==============================================================================
//==============================================================================
// Global variables
//==============================================================================
//==============================================================================
//==============================================================================
// Global functions
/// HIFN The main entry-point function.
int main (int argc, char *argv[])
{
int error = 0;
/* initialize and load resources */
nullChk (InitCVIRTE (0, argv, 0));
errChk (panelHandle = LoadPanel (0, "FlowCVI.uir", PANEL));
/*
Load the library into memory. We assume the dll is located in
the windows system (or system32) directory, so we only / have
to supply the filename (instead of the whole path)
*/
hLibHandle = LoadLibrary("Flowb32.dll");
printf ("ID of the hLibHandle = %d\n", hLibHandle);
/*Check if a valid handle has been received*/
if (hLibHandle != 0)
{
// Ok, Valid lib-handle
printf ("Ok, valid Lib-handle \n");
/*
Locate / get the address of the function within the libary.
We have to cast the pointer that was returned to a
function pointer of type _OpenDLL
*/
OpenDLL = (_OpenDLL) GetProcAddress(hLibHandle, "OpenDLL");
printf ("OpenDLL handle = %d\n", OpenDLL);
/*Check if a valid address has been returned*/
if (OpenDLL != 0)
{
/*
Ok, valid address
Now call the function, and print the result to
the terminal
*/
printf("%s %d\n","ID of the application = ",
OpenDLL(0));
/*Library no longer needed, remove it from memory*/
//FreeLibrary(hLibHandle);
}
}
/* display the panel and run the user interface */
errChk (DisplayPanel (panelHandle));
errChk (RunUserInterface ());
Error:
/* clean up */
DiscardPanel (panelHandle);
return 0;
}
//==============================================================================
//==============================================================================
//==============================================================================
// UI callback function prototypes
/// HIFN Exit when the user dismisses the panel.
int CVICALLBACK panelCB (int panel, int event, void *callbackData,
int eventData1, int eventData2)
{
if (event == EVENT_CLOSE)
QuitUserInterface (0);
return 0;
}
//==============================================================================
//================================
01-16-2015 07:14 AM