• Welcome to Valhalla Legends Archive.
 

VB TypeDefs? Converting C++ to VisualBasic

Started by Dyndrilliac, June 25, 2005, 07:26 PM

Previous topic - Next topic

Dyndrilliac

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?
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

Adron

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....

Dyndrilliac

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?
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

Dyndrilliac

Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.