Hi, I have these errors:

--------------------Configuration: IP_devllink_06 - Win32 Debug--------------------
Linking...
IP_devlink_06.obj : error LNK2001: unresolved external symbol _DLClose@4
IP_devlink_06.obj : error LNK2001: unresolved external symbol _DLOpen@24
Debug/IP_devllink_06.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

IP_devllink_06.exe - 3 error(s), 0 warning(s)

The probloem is that I am including my header in the project, and the name of these functions are the same (DLOpen and DLClose) when I compile, it runs well but when I try to Build the Link doesn't work

Any idea to solve it?

Thanks in advance.

Please post at least head of your header file...

Until then, this: googleing!

says this:

Linker Tools Error LNK2001

unresolved external symbol "symbol"

Code references something (such as a function, variable, or label) that the linker can't find in the libraries and object files.

Possible causes

* What the code asks for doesn't exist (the symbol is spelled incorrectly or uses the wrong case, for example).
* The code asks for the wrong thing (you are using mixed versions of the libraries, some from one version of the product, others from another version).

This error message is followed by fatal error LNK1120.

Insufficient info.
As usually, no function definitions in the header. Where are these functions bodies? The linker can't obtain them. Check out all sources, libraries and the project settings.

this is my header code, and I am including in the project:

[/********************************************************************/
/* */
/* C/C++ Header File (c) 2001 Avaya Global SME Solutions */
/* */
/* Contents:- */
/* IP Office Dev link DLL provides an interface for managing */
/* the IP Office product ranges from a Windows PC. */
/********************************************************************/
#ifndef _DEVLINK_H_
#define _DEVLINK_H_
typedef char TEXT;
#define DEVLINK_SUCCESS - 0
#define DEVLINK_UNSPECIFIEDFAIL 1
#define DEVLINK_LICENCENOTFOUND 2
#define DEVLINK_COMMS_OPERATIONAL 0
#define DEVLINK_COMMS_NORESPONSE 1
#define DEVLINK_COMMS_REJECTED 2
#define DEVLINK_COMMS_MISSEDPACKETS 3
#ifdef __cplusplus
extern "C"
{
#endif
typedef void (CALLBACK * CALLLOGEVENT)(
LONG pbxh,
TEXT * info
);
typedef void (CALLBACK * COMMSEVENT)(
LONG pbxh,
DWORD comms_state,
DWORD parm1
);
LONG PASCAL DLOpen( HANDLE pbxh
, TEXT * pbx_address
, TEXT * pbx_password
, TEXT * reserved1
, TEXT * reserved2
, COMMSEVENT cb
);
LONG PASCAL DLClose( LONG pbxh );
LONG PASCAL DLRegisterType2CallDeltas( LONG pbxh, CALLLOGEVENT cb );
#ifdef __cplusplus
};
#endif
#endif // _DEVLINK_H_]

I have the same name for these (DLOpen - DLClose) but even have the Link error...

Please, read my previous post again (and again ;) ).
Where are these two functions DEFINED???
You post DECLARATIONS (prototypes) of these functions.

For example, I (header file) declare: I have 2000000000$.
You (linker) ask me: where are this lots of money?

this is my .cpp code where i call these functions, I'm including the
#include "devlink.h"
instruction and
#include "stdAfx.h"
that I read I need to get the Link

[#include "stdAfx.h"
#include <windows.h>
#include <stdio.h>
#include "devlink.h"
LONG hEvent;
DWORD dwCommsEvent;
BOOL bStarting;
void CALLBACK HandleCommsEvent( LONG pbxh, DWORD comms_evt, DWORD parm1 )
{
switch( comms_evt ) {
case DEVLINK_COMMS_OPERATIONAL:
// we are working fine... fall through
case DEVLINK_COMMS_NORESPONSE:
// system not found (initial connection),
// or network connection lost (rebooted?)
// fall through...
case DEVLINK_COMMS_REJECTED:
// incorrect system password specified...
if( bStarting ) {
dwCommsEvent = comms_evt;
SetEvent( hEvent );
}
else {
// insert your code here...
}
break;
case DEVLINK_COMMS_MISSEDPACKETS:
// Indicates that the system is under
// heavy load. IP Office always prioritises
// data routing and call handling above CTI events.
// (parm1 contains the number of packets missed)
break;
}
}
int main(int argc, char* argv)
{
printf( "connecting...");
bStarting = TRUE;
hEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
DLOpen( 0,
"255.255.255.255",
"systempassword",
NULL,
NULL,
HandleCommsEvent );
dwCommsEvent = DEVLINK_COMMS_NORESPONSE;
WaitForSingleObject( hEvent, 10000L ); // 10 seconds
bStarting = FALSE;
if( dwCommsEvent == DEVLINK_COMMS_OPERATIONAL ) {
printf("Connected OK\n");
}
else {
printf("Error connecting to IP Office\n");
}
DLClose( 0 );
CloseHandle( hEvent );
return 0;
}]

Ooh... I know English is not my native language but...

I'm not interesting where you CALL these functions.
My question was: where were these two functions defined? A function definition code looks like

type function_name(parameters)
{
    function_body
}

Where is

LONG PASCAL DLOpen(....)
{
   ...
}

???
Probably these functions were placed in the library. Did you attach this library to your project? Where is this library?..

these are in my header file (devlink.h) and the code is:

LONG PASCAL DLOpen( HANDLE pbxh
, TEXT * pbx_address
, TEXT * pbx_password
, TEXT * reserved1
, TEXT * reserved2
, COMMSEVENT cb
);
LONG PASCAL DLClose( LONG pbxh );

I'm including my header file (devlink.h) as part of my project, and put the instruction to "LINK"
#include "devlink.h"
in my .cpp code, (I send the complete code in previous messages)

I see you don't understand a difference between a function declaration (prototype) and a functions definition (header+body). The DLOpen function prototype in your header file is not the DLOpen function. It's a declaration only. You declare (to compiler): "See, I have this function elsewhere. Let this functions calls in my code below correspond the prototype". A prototype does not generate machine code. If you call DLOpen in your program, you must have this function definition (header+body) in your source codes or in an external library (included in the project).

Obviously you don't know where is DLOpen and where is DLClose source or object codes.
I don't know as well...

I found these functions in dlfcn.h and I need to add the cdefs,h
I include in my projects, but now I have this error:

Deleting intermediate files and output files for project 'prueba_IP_devlink_08 - Win32 Debug'.
--------------------Configuration: prueba_IP_devlink_08 - Win32 Debug--------------------
Compiling...
prueba_08.cpp
Linking...
dlfcn.h : fatal error LNK1136: invalid or corrupt file
Error executing link.exe.

prueba_IP_devlink_08.exe - 1 error(s), 0 warning(s)

I don't know what you found in .h file but it seems the functions body was placed in .cpp or .c file.
In any case you are trying to feed .h (text) file to the linker...

Yes, I create my dlfcn.h as a header of my project, with this code:

#ifndef _DLFCN_H
#define _DLFCN_H 1

#include "cdefs.h"

#define RTLD_LAZY	0x00000
#define RTLD_NOW	0x00001

#define RTLD_LOCAL	0x00000
#define RTLD_GLOBAL	0x10000

#define RTLD_DEFAULT	((void*)1)
#define RTLD_NEXT	((void*)2)

#ifdef __cplusplus
extern "C" {
#endif


__BEGIN_DECLS

void *dlopen (const char *filename, int flag);
const char *dlerror(void);
void *dlsym(void *handle, char *symbol);
int dlclose (void *handle);

__END_DECLS

#ifdef __cplusplus
}
#endif
#endif /* DLFCN_H */

then I found that I need the cdefs.h and I create it too, and I went to project/settings/Object/Library modules and add dlfcn.lib & cdefs.lib and went to:
C:/Archivos de programa/Microsoft/visual Studio/VC98/Include
and I put it down a copy of my dlfcn.h and cdefs.h files

As far as I could judge it's a header file of Linux dlopen function (prototype, declaration but not definition again). It does not bear a relation to your Visual C++ (6.0 ? ) project.

I never used DevLink library for Windows. It seems you are trying to link your code with this library (may be I'm wrong). As far as I know there is devlink.lib in this package (and devlink.dll, but it's the other story). If so you must add this .lib file to your project settings.

Does you really hope to implement a useful program without any docs for third-party library used? Look at http://support.avaya.com/elmodocs2/ip_office/R3.1/devlinken.pdf. It's DevLink library manual. See notes on page 5. May be it helps...

I got my CD's and download all requieres files but now when I run my program from VSC++ it works but if I try to run my .EXE send the error that not found the devlink.dll file.
In the intallation manual said:
Any application that uses the DevLink DLL should include it in the application installation script.
But I don't undestand how can I do that, maybe I have to copy this file in any folder.
Could you help me please about it?

Try to copy it into the same folder where exe was placed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.