Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Dyndrilliac on June 25, 2005, 07:26 PM

Title: VB TypeDefs? Converting C++ to VisualBasic
Post by: Dyndrilliac on June 25, 2005, 07:26 PM
typedef char* (*SomeRandomFunction1)();
typedef int (*SomeRandomFunction2)(long);
typedef int (*SomeRandomFunction3)();
typedef int (*SomeRandomFunction4)();


I need to convert the above code into the Visual Basic equivalent. Now, because VB (AFAIK) does not have prototypes or pointers, I'm at a loss on how to go about doing this.

I tried to do it myself and came up with this:Private CStr(SomeRandomFunction1) As StringBut that's hopelessly wrong. Can anyone point me in the right direct?
Title: Re: VB TypeDefs? Converting C++ to VisualBasic
Post by: Adron on June 25, 2005, 07:28 PM
As long as you just want to declare a variable to hold such a pointer, this works as an equivalent:

Dim SomeRandomFunction1 As Long

On 32-bit windows, those statements allocate space for a 4-byte value. Now if you want to actually *use* them in some way....
Title: Re: VB TypeDefs? Converting C++ to VisualBasic
Post by: Dyndrilliac on June 25, 2005, 07:33 PM
Well, yes - those variables are going to be used with GetProcAddress to get a few functions from a library I've loaded, and I want to be able to use them to call the functions as I would in C++. Is this not possible in VB?
Title: Re: VB TypeDefs? Converting C++ to VisualBasic
Post by: Dyndrilliac on June 26, 2005, 03:37 AM
Problem resolved.