Home > Software engineering >  Exe calls a DLL interface problem
Exe calls a DLL interface problem

Time:11-07

//HSM. H: the main header file for the HSM DLL
//

# if! Defined (AFX_HSM_API_H__1CAAF23E_019C_4B36_AEB1_EA50300F4D03__INCLUDED_)
# define AFX_HSM_API_H__1CAAF23E_019C_4B36_AEB1_EA50300F4D03__INCLUDED_


# if _MSC_VER & gt; 1000
# pragma once
# endif//_MSC_VER & gt; 1000

# # ifndef __AFXWIN_H__
# error include 'stdafx. H before o this file for PCH
# endif

# ifdef ALLALOGO
# define DLLEXPORT_API __declspec (dllexport)
The else
# define DLLEXPORT_API __declspec (dllimport)
# endif

# include "resource. H"//the main symbols
#include

/////////////////////////////////////////////////////////////////////////////
//CHsmApp
//See HSM. CPP for the implementation of this class
//

The class CHsmApp: public CWinApp
{
Public:
CHsmApp ();

//Overrides
//ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL (CHsmApp)
Public:
Virtual BOOL InitInstance ();
//}} AFX_VIRTUAL

//{{AFX_MSG (CHsmApp)
//NOTE - the ClassWizard will add and remove member functions provides here.
//DO NOT EDIT what you see in these blocks of generated code!
//}} AFX_MSG
DECLARE_MESSAGE_MAP ()
};

# if defined (__cplusplus)
Extern "C" {
# endif

Strin DLLEXPORT_API int _stdcall get_MD5 (unsigned char * and an int Datalen, BYTE * Dataout);
DLLEXPORT_API int _stdcall hsmopen (char * Ipadd, u_short Port);
Indata DLLEXPORT_API int _stdcall hsmenc_ZMK (BYTE * and short Keyindex, short DataLen, BYTE * Resp);
Indata DLLEXPORT_API int _stdcall hsmdec_ZMK (BYTE * and short Keyindex, short DataLen, BYTE * Resp);
DLLEXPORT_API void _stdcall hsmclose ();
Indata DLLEXPORT_API int _stdcall DT_Pro (BYTE * and short DataLen, WORD iMode, BYTE * Output);
DLLEXPORT_API int _stdcall zmk_test (short Keyindex);
# if defined (__cplusplus)
}
# endif


/////////////////////////////////////////////////////////////////////////////
# endif



Compile operation is as follows:
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the Configuration: test - Win32 Debug -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Compiling...
TestDlg. CPP
C: \ zhanyan \ system \ \ small tools hsmcode \ HSM \ test \ hsm_api h (53) : error C2144: syntax error: missing '; 'before the type' int '
C: \ zhanyan \ system \ \ small tools hsmcode \ HSM \ test \ hsm_api h (53) : error C2501: 'DLLEXPORT_API: missing storage - class or type specifiers
C: \ zhanyan \ system \ \ small tools hsmcode \ HSM \ test \ hsm_api h (53) : fatal error C1004: unexpected end of file found
Error executing cl. Exe.

Test. Exe - 3 error (s), and 0 warning (s)


An error before tip is below this function int lost; All, don't look to see what problem, remove DLLEXPORT_API, that would be all right,
Strin DLLEXPORT_API int _stdcall get_MD5 (unsigned char * and an int Datalen, BYTE * Dataout);


What is willing to? Also please bosses to see see! Thank you very much!

CodePudding user response:

# ifdef ALLALOGO
# define DLLEXPORT_API __declspec (dllexport)
The else
# define DLLEXPORT_API __declspec (dllimport)
# endif

The

# define DLLEXPORT_API __declspec (dllimport)
To:
# define DLLEXPORT_API extern "C" __declspec (dllimport)

Try

Seems to mean no call way

CodePudding user response:

reference 1/f, tiger bobo response:
# ifdef ALLALOGO
# define DLLEXPORT_API __declspec (dllexport)
The else
# define DLLEXPORT_API __declspec (dllimport)
# endif

The

# define DLLEXPORT_API __declspec (dllimport)
To:
# define DLLEXPORT_API extern "C" __declspec (dllimport)

Try
reference


Seems to mean no way call



CodePudding user response:

You put the

# ifdef ALLALOGO
# define DLLEXPORT_API __declspec (dllexport)
The else
# define DLLEXPORT_API __declspec (dllimport)
# endif

In a

# include "resource. H"//the main symbols
#include

Behind a try?


In addition

# if defined (__cplusplus)
Extern "C" {
# endif

Strin DLLEXPORT_API int _stdcall get_MD5 (unsigned char * and an int Datalen, BYTE * Dataout);
DLLEXPORT_API int _stdcall hsmopen (char * Ipadd, u_short Port);
Indata DLLEXPORT_API int _stdcall hsmenc_ZMK (BYTE * and short Keyindex, short DataLen, BYTE * Resp);
Indata DLLEXPORT_API int _stdcall hsmdec_ZMK (BYTE * and short Keyindex, short DataLen, BYTE * Resp);
DLLEXPORT_API void _stdcall hsmclose ();
Indata DLLEXPORT_API int _stdcall DT_Pro (BYTE * and short DataLen, WORD iMode, BYTE * Output);
DLLEXPORT_API int _stdcall zmk_test (short Keyindex);
# if defined (__cplusplus)
}
# endif


nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related