Home > Software engineering >  Using VC call others with Delphi dynamic library access conflict and unable to load what reason be e
Using VC call others with Delphi dynamic library access conflict and unable to load what reason be e

Time:11-20

Because recently want to be a PC and PLC communication software, so find a person on the Internet DLL library written in Delphi PLC communication, should be 32 bits, I write a MFC in VC2015 to invoke this DLL found always prompt access conflict, the call fails, because someone else is to write image processing, the environment must use VC 2015, but contact the man he said others used is no problem, I just started to learn this software, because is no DLL source code, don't know what is the problem, the following is my program source code, other DLL function declarations are useless, I just use LoadlibraryA found have failed, can * * if you have a friend in a 32-bit (64) better solution and debugging c + + MFC environment, * *

Part I add within the reference lines, everything else is the wizard generated, attachment there is a call of library,
https://pan.baidu.com/s/1UB1dOh4fZ0rMauP63avGcA
 
//MFC - PLC21Dlg. CPP: implementation file
//

# include "stdafx. H"
MFC - PLC21. # include "h"
MFC - PLC21Dlg. # include "h"
# include "afxdialogex. H"

# ifdef _DEBUG
# define new DEBUG_NEW
# endif

/////////////////////////////////////////////////////////////////
HINSTANCE hinstDLL;

Typedef int (_stdcall * pOpen) (int nport, int BaudRate, int DataBits, char * Parity, int StopBits, char * User);
Typedef int (_stdcall * pClose) (int nport);
Typedef int (_stdcall * pSetDelay) (int value);
Typedef int (_stdcall * pComTrue) (int nport);
Typedef int (_stdcall * pComWork) (int nport);

Typedef int (_stdcall * pReadBit) (int nport, int the node, element, char * int address, int Bit);
Typedef int (_stdcall * pReadByte) (int nport, int the node, element, char * int address, int Count, int * RxdBuffer);
Typedef int (_stdcall * pReadInt) (int nport, int the node, element, char * int address, int Count, int * RxdBuffer);
Typedef int (_stdcall * pReadDInt) (int nport, int the node, element, char * int address, int Count, int * RxdBuffer);
Typedef int (_stdcall * pReadFloat) (int nport, int the node, element, char * int address, int Count, float * RxdBuffer);

Typedef int (_stdcall * pBitWrite) (int nport, int the node, element, char * int address, int Bit, int value);
Typedef int (_stdcall * pBitEWrite) (int nport, int the node, element, char * int address, int Bit, int value);
Typedef int (_stdcall * pEbitCancel) (int nport, int the node, element, char * int address, int Bit);

Typedef int (_stdcall * pWriteByte) (int nport, int the node, element, char * int address, int Count, int * TxdBuffer);
Typedef int (_stdcall * pWriteInt) (int nport, int the node, element, char * int address, int Count, int * TxdBuffer);
Typedef int (_stdcall * pWriteDInt) (int nport, int the node, element, char * int address, int Count, int * TxdBuffer);
Typedef int (_stdcall * pWriteFloat) (int nport, int the node, element, char * int address, int Count, float * TxdBuffer);

Typedef int (_stdcall * pPlcRun) (int nport, int node);
Typedef int (_stdcall * pPlcStop) (int nport, int node);

Typedef int (_stdcall * pBitBin) (int value, int Bitaddress);
Typedef int (_stdcall * p16I_8h) (int value);
Typedef int (_stdcall * p16I_8l) (int value);
Typedef int (_stdcall * p8I_16I) (int valueH, int valueL);
Typedef int (_stdcall * p32I_16h) (int value);
Typedef int (_stdcall * p32I_16l) (int value);
Typedef int (_stdcall * p16I_32I) (int valueH, int valueL);
Typedef int (_stdcall * p32f_16h) (float value);
Typedef int (_stdcall * p32f_16l) (float value);
Typedef float (_stdcall * p16I_32f) (int valueH, int valueL);

POpen mOpen;
The pClose mClose;
PSetDelay mSetDelay;
PComTrue mComTrue;
PComWork mComWork;

PReadBit mReadBit;
PReadByte mReadByte;
PReadInt mReadInt;
PReadDInt mReadDInt;
PReadFloat mReadFloat;

PBitWrite mBitWrite;
PBitEWrite mBitEWrite;
PEbitCancel mEbitCancel;

PWriteByte mWriteByte;
PWriteInt mWriteInt;
PWriteDInt mWriteDInt;
PWriteFloat mWriteFloat;

PPlcRun mPlcRun;
PPlcStop mPlcStop;

PBitBin mBitBin;
P16I_8h m16I_8h;
P16I_8l m16I_8l;
P8I_16I m8I_16I;
P32I_16h m32I_16h;
P32I_16l m32I_16l;
P16I_32I m16I_32I;
P32f_16h m32f_16h;
P32f_16l m32f_16l;
P16I_32f m16I_32f;
///////////////////////////////////////////////////////////////

//for application "about" menu item CAboutDlg dialog

The class CAboutDlg: public CDialogEx
{
Public:
CAboutDlg ();

//data dialog
# ifdef AFX_DESIGN_TIME
Enum {IDD=IDD_ABOUTBOX};
# endif

Protected:
Virtual void DoDataExchange (CDataExchange * symbol;//support DDX/DDV

//implementation
Protected:
DECLARE_MESSAGE_MAP ()
};

CAboutDlg: : CAboutDlg () : CDialogEx (IDD_ABOUTBOX)
{
}

Void CAboutDlg: : DoDataExchange (CDataExchange * symbol)
{
CDialogEx: : DoDataExchange (symbol);
}

BEGIN_MESSAGE_MAP (CAboutDlg CDialogEx)
END_MESSAGE_MAP ()


//CMFCPLC21Dlg dialog



CMFCPLC21Dlg: : CMFCPLC21Dlg (pParent/*=NULL CWnd * */)
: CDialogEx (IDD_MFCPLC21_DIALOG, pParent)
{
M_hIcon=AfxGetApp () - & gt; LoadIcon (IDR_MAINFRAME);
}

Void CMFCPLC21Dlg: : DoDataExchange (CDataExchange * symbol)
{
CDialogEx: : DoDataExchange (symbol);
}

BEGIN_MESSAGE_MAP (CMFCPLC21Dlg CDialogEx)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related