|
-
Sep 16th, 2001, 06:08 PM
#1
Thread Starter
Fanatic Member
Importing C++ DLL to VB - 2d array from vb to c++
I made a dll in C++, the dll was originally made in vb, but i just did a basic conversion to c++ for speed and performance reasons. But for some reason, vb doesnt understand the dll. Any help would be appriciated, thanks.
--see the last post.
-MoMad
Last edited by MoMad; Sep 23rd, 2001 at 06:58 PM.
-
Sep 17th, 2001, 05:39 PM
#2
Thread Starter
Fanatic Member
Here's the problem:
I have a dll made in C++. With 2 functions and a variable, but i want to use these functions inside vb.
Code:
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the SPECIALEFFECTS_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// SPECIALEFFECTS_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef SPECIALEFFECTS_EXPORTS
#define SPECIALEFFECTS_API __declspec(dllexport)
#else
#define SPECIALEFFECTS_API __declspec(dllimport)
#endif
#define MAX 1024
// This class is exported from the SpecialEffects.dll
// [variables]
extern SPECIALEFFECTS_API BYTE LookupTable[18][256][256];
extern SPECIALEFFECTS_API BOOL initialized;
// [functions]
extern SPECIALEFFECTS_API void doEffect(int effect, long src, long dest);
// public declare sub InitEffects Lib "SpecialEffects" ()
extern SPECIALEFFECTS_API void InitEffects(void);
// public declare sub SpecialBltArray Lib "SpecialEffects" (SrcArray() As Byte, _
// DestArray() As Byte, ByVal dX as Long, ByVal dY as Long, _
// SrcX As Long, SrcY As Long, SrcWid As Long, SrcHgt As Long, LookupTableIndex As Long);
extern SPECIALEFFECTS_API void SpecialBltArray(BYTE * SrcArray[], BYTE * DestArray[], long dX, long dY,
long SrcX, long SrcY, long SrcWid, long SrcHgt,
long LookupTableIndex);
But i seem to be missing something to make it compatible with vb because vb is giving me "DLL entry point Not found" when i call these functiions.
Please help.
-MoMad
-
Sep 18th, 2001, 01:32 AM
#3
Thread Starter
Fanatic Member
Ok. I got the DLL made, but now its giving me Illigal Operation Performed - Close.
So please anyone, help.
I tried everything, how do you go about debugging it???? All i see is machine code whenever i try debugging! Look:
Code:
?SpecialBltArray@@YGXQAY0EAA@E0JJJJJJJ@Z:
100010A0 E8 65 FF FF FF call @ILT+5(InitEffects) (1000100a)
100010A5 8B 44 24 1C mov eax,dword ptr [esp+1Ch]
100010A9 85 C0 test eax,eax
100010AB 0F 8E 8B 00 00 00 jle SpecialBltArray+9Ch (1000113c)
100010B1 8B 4C 24 0C mov ecx,dword ptr [esp+0Ch]
100010B5 8B 54 24 04 mov edx,dword ptr [esp+4]
100010B9 53 push ebx
100010BA 55 push ebp
100010BB 8B 6C 24 1C mov ebp,dword ptr [esp+1Ch]
100010BF 56 push esi
100010C0 C1 E1 0A shl ecx,0Ah
100010C3 C1 E5 0A shl ebp,0Ah
100010C6 89 4C 24 28 mov dword ptr [esp+28h],ecx
100010CA 8B 4C 24 24 mov ecx,dword ptr [esp+24h]
100010CE 03 EA add ebp,edx
100010D0 57 push edi
100010D1 03 E9 add ebp,ecx
100010D3 8B 4C 24 30 mov ecx,dword ptr [esp+30h]
100010D7 89 44 24 1C mov dword ptr [esp+1Ch],eax
100010DB 33 C0 xor eax,eax
100010DD 85 C9 test ecx,ecx
100010DF 7E 38 jle SpecialBltArray+79h (10001119)
100010E1 8B 7C 24 34 mov edi,dword ptr [esp+34h]
100010E5 8B 74 24 20 mov esi,dword ptr [esp+20h]
100010E9 C1 E7 08 shl edi,8
100010EC 8B 4C 24 2C mov ecx,dword ptr [esp+2Ch]
100010F0 8B 54 24 18 mov edx,dword ptr [esp+18h]
100010F4 03 CE add ecx,esi
100010F6 33 DB xor ebx,ebx
100010F8 8A 1C 28 mov bl,byte ptr [eax+ebp]
100010FB 03 CA add ecx,edx
100010FD 33 D2 xor edx,edx
100010FF 8A 11 mov dl,byte ptr [ecx]
10001101 03 D7 add edx,edi
10001103 C1 E2 08 shl edx,8
10001106 40 inc eax
10001107 46 inc esi
10001108 8A 94 1A 0C 33 01 10 mov dl,byte ptr [edx+ebx+1001330Ch]
1000110F 88 11 mov byte ptr [ecx],dl
10001111 8B 4C 24 30 mov ecx,dword ptr [esp+30h]
10001115 3B C1 cmp eax,ecx
10001117 7C D3 jl SpecialBltArray+4Ch (100010ec)
10001119 8B 74 24 2C mov esi,dword ptr [esp+2Ch]
1000111D 8B 44 24 1C mov eax,dword ptr [esp+1Ch]
10001121 81 C6 00 04 00 00 add esi,400h
10001127 81 C5 00 04 00 00 add ebp,400h
1000112D 48 dec eax
1000112E 89 74 24 2C mov dword ptr [esp+2Ch],esi
10001132 89 44 24 1C mov dword ptr [esp+1Ch],eax
10001136 75 A3 jne SpecialBltArray+3Bh (100010db)
10001138 5F pop edi
10001139 5E pop esi
1000113A 5D pop ebp
1000113B 5B pop ebx
1000113C C2 24 00 ret 24
Here is the source code.
http://server2045.virtualave.net/mom...0-DLL-2-VB.zip
-
Sep 18th, 2001, 07:35 AM
#4
PowerPoster
MoMad, does my another post help?
regards
-
Sep 18th, 2001, 10:50 AM
#5
Thread Starter
Fanatic Member
Which post are u talking about??
-
Sep 18th, 2001, 07:44 PM
#6
PowerPoster
-
Sep 18th, 2001, 11:04 PM
#7
Thread Starter
Fanatic Member
Thanks
-
Sep 23rd, 2001, 06:57 PM
#8
Thread Starter
Fanatic Member
Passing 2d Array Pointer to C++ DLL
OK, what im trying to do EXACTLY is that I want to pass a 2D array from VB to the dll and modify that array.
I have tried the MSDN and everything there is to try but they all talk of a single dimension array.
I tried Array(0,0) but that just gives me an error in VB. also, if i try just passing Array() that will also give me an error in VB.
ANY HELP HERE????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|