AnsweredAssumed Answered

vrf dll's and header conversion

Question asked by VRFuser on Sep 25, 2008
> Guidelines, suggestions anything
> more in depth than the docs in VEE help.

Get rid of anything that starts with #.

All functions need to be either stdcall or cdecl. VEE won't do fastcall or thiscall. If the public API does not include something like:

#ifdef __cplusplus
extern "C" {
<stuff>
}
#endif

Then you might have to create a proxy dll to call the functions.

Any typedefs must be accounted for by other means. Simple types can be translated to VEE's types by using the type table:
http://www.vrfarchive.com/vrf_archive/CProgramming101.htm#refTypeTable

Oops, web is down (duh!) Type Table:

VEE Type      C Type      Data Size      Comments     
UInt8      char      1 Byte      Not usable over the CFI.     
Int16      short      2 Bytes      Sometimes called a word.     
Int32      long      4 Bytes      Sometimes called a double word.     
Real32      float      4 Bytes            
Real64      double      8 Bytes            
Text      char*      4 Bytes      See note 1.     
(none)      int      4 Bytes?      See note 2.     

Don't fret about unsigned. Some Windows types you'll see:

Name      Type      Size      Comments     
DWORD      unsigned long      4 Bytes      Four bytes is called a Double Word.     
INT      int      4 Bytes      Just an alias for int.     
UINT      unsigned int      4 Bytes            
LONG      long      4 Bytes      Just an alias for long.     
BOOL      int      4 Bytes      Boolean, Yes or No, True or False.     
BYTE      unsigned char      1 Byte            
WORD      unsigned short      2 Bytes      Two bytes is called a Word.     
FLOAT      float      4 Bytes      Just an alias for float.     
LPFLOAT      float*      4 Bytes      Pointer to FLOAT.     
LPBOOL      int*      4 Bytes      Pointer to BOOL.     
LPBYTE      unsigned char*      4 Bytes      Pointer to BYTE.     
LPINT      int*      4 Bytes      Pointer to INT.     
LPWORD      unsigned short*      4 Bytes      Pointer to WORD.     
LPLONG      long*      4 Bytes      Pointer to LONG.     
LPDWORD      unsigned long*      4 Bytes      Pointer to DWORD.     
LPVOID      void*      4 Bytes      Pointer to any type (see next section)..     
UINT_PTR      unsigned int      4 Bytes      Used for "polymorphic types".     
ULONG_PTR      unsigned long      4 Bytes      Used for "polymorphic types".     
WPARAM      unsigned int      4 Bytes      Used to be "word param", used in messages.     
LPARAM      long      4 Bytes      "Long param", used in messages.     
LRESULT      long      4 Bytes      "Long result".     
HANDLE      void*      4 Bytes      "Handle" to object.     
LPTSTR      char*      4 Bytes      Pointer to string, i.e. VEE Text var.     

Compound types can usually be stuffed into VEE arrays. Sometimes you wind up using GlobalAlloc & dereferencing actual memory (not usually though).

There are a bunch of general guidelines through out C Programming 101 and Windows Programming 101. These documents will be accessible as soon as I finish maintenance (should be pretty soon now). If you run into really horrendous compound types, Type Spoofin' For Dummies will show you how to do almost anything.
-SHAWN-

Outcomes