안녕하세요? 귀염둥이하기스입니다.
현재 C에서 작성된 DLL인데, Visual Studio 2010의 VB에서 사용해야하는데 어떻게 해야하나요?
-------------------------------------------------------------------------------------------------------------
■ C DLL작성시 선언된 부분
typedef long X_CONTENT;
typedef struct {
int USER_ID;
char USER_NAME[31];
int USER_PRIVIEGE;
char USER_ENABLED;
} HEADER;
typedef struct {
HEADER INFO;
int LEN;
char PHOTO[30*1024];
} USER_INFO;
typedef struct {
char NUMBER;
int DATA_LEN;
char DATA[30*1024];
} OBJECT_DATA;
typedef void (__stdcall *TDisconnectCallback)(void* ctx, const char state);
typedef void (__stdcall *TBroadcastCallback)(void* ctx, const char* devID, const char* data, const char broadcastType);
#ifdef DLL_API_EXPORTS
#define API __declspec(dllexport)
#else
#define API __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
API int __stdcall GetUserInfo(X_CONTEXT session, const char* ID, const int userID, USER_INFO* info, OBJECT_DATA obj[], int* Count);
API int __stdcall _GetUserIDList(X_CONTEXT session, const char* devID, int userIDList[], int* count);
API int __stdcall DisconnectCallback(X_CONTEXT session, TDisconnectCallback callback, void* ctx);
API int __stdcall BroadcastCallback(X_CONTEXT session, TBroadcastCallback callback, void* ctx);
------------------------------------------------------------------------------------------------
위에 대해 VS2010 VB에서 아래와 같이 선언했는데, 오류가 나고, CallBack에 대해 어떻게 처리해야 되는지 회답좀 부탁드립니다.
■ VB에 작성된 부분
Class HEADER_CLASS
Public USER_ID As Long
Public USER_NAME(31) As Byte
Public USER_PRIVILEGE As Long
Public USER_ENABLED As Byte
End Class
Class USER_INFO_CLASS
Public INFO As HEADER_CLASS
Public PHOTO_LEN As Long
Public PHOTO(30 * 1024) As Byte
End Class
Class OBJECT_DATA_CLASEE
Public NUMBER As Char
Public DATA_LEN As Integer
Public DATA(30*1024) As Char
End Class
Declare Function GetUserIDList Lib "X.dll" Alias "GetUserIDList" (ByVal session As Long, ByRef devID As String, ByRef userIDList() As Integer, ByRef count As Integer) As Integer
----------------------------------------------------------
■ 실행문
Dim gSession as Long
Dim gStatus as Integer
Dim icount As Integer
Dim UserID(100) As Integer
Dim vDevID As String = "E66668185B32A835"
gStatus = GetUserIDList(gSession, vDevID, UserID(1), icount)
---------------------------------------------------------------------
위와 같이 하면
이런 오류가 발생합니다.
이에 자료가 어디가 잘못됬는지 확인 부탁드립니다.
그리고, CallBack함수를 사용해야 하는데, 어떻게 선언해야 할지 몰라서요~
typedef void (__stdcall *TDisconnectCallback)(void* ctx, const char state);
typedef void (__stdcall *TBroadcastCallback)(void* ctx, const char* devID, const char* data, const char broadcastType);
이에 대한 부분좀 부탁드립니다.
좋은 하루되세요!