System: Win32 (XP SP2), AMD 64 X2
Compiler/IDE: Turbo Delphi + Hotfix Rollup
Libraries/API: N/A


Alrighty, I'll get down to it quickly. I'm trying to create a "stack" of potentially variant types to use in functions, but I also am aware that variants can take a bit of size. So, I figured that I would use a void type. Usually I can do something like:
Code:
function HandleThis(const thisvar): boolean;
begin
  TObject(thisvar).Free;
  result := true;
end;
(And yes I am aware the function is bogus.) But, if I were to create a record of these types Delphi chokes, stating that:
Code:
[Pascal Error] Project1.dpr(8): E2029 Type expected but ';' found.
There is no void type and I am reluctant to use a variant right now.

So, the question boils down to how do I treat pointers as voids, find their types, and then handle them in a function without breaking anything? System.TypeOf() returns a pointer, I assume to a string passed by the C/C++ function, but what do I do with it?

EDIT:

Trying this program gives the following error...
Code:
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var a: TObject;

begin
  a := TObject.Create;
  if TypeOf(a) = TObject then
    writeln('a is an object!');
  readln;
end.
Code:
[Pascal Error] Project1.dpr(12): E2017 Pointer type required
WTH?? :? What the heck is that supposed to mean!?