Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / vftable problem make me wanna kill my computer Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
pixelpajas

February 22, 2005, 05:22 AM

The problems seem to never end. =P

Ok. I am currently working on a small graphical C++ project (using VC++ 2005)
and i decided to try and and remove all the default libs and se how small
i could get the executable to become (using the /NODEFAULTLIB flag amongst other things). I am only using the d3d9.lib kernel32.lib libs btw.

So i did my new and delete overloading first:

  1.  
  2. //-------------------------------------------
  3. static void* operator new (size_t size)
  4. {
  5.   void *p = GlobalAlloc(0, size);
  6.   if (p==0) MessageBoxA(0, "error in alloc", "error", MB_OK);
  7.   return p;
  8. }
  9. //-------------------------------------------
  10. static void operator delete (void *p)
  11. {      
  12.   GlobalFree(p); // return memory to pool
  13. }
  14.  


And it all seemd to work fine.
And had a couple of other problems but i managed to fix them to.
Now the only thing remaining is that i get a:

-> error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)


It seems to be realated to RTTI and I'm not using any "try", "catch" or "throw"'s in my code. But all of that is disabled in the project settings.
So.. is there anyone that has an idea what the problem might be?


cheers
//iman

 
Axel

February 22, 2005, 05:24 AM

You can disable exception handling and RTTI in the project settings. They don't have anything to do with each other by the way.

 
pixelpajas

February 22, 2005, 05:27 AM



did that already.

//iman

 
Rui Martins

February 22, 2005, 05:42 AM

You are probably missing some lib where "type_info" is defined.

 
Alex Herz

February 22, 2005, 07:07 AM

AFAIK the vftable is used for virtual functions and is not related to RTTI.
You'll have to find the lib that defines "const type_info::`vftable'" and link it back in.

Alex

 
stephenhazel

February 22, 2005, 01:44 PM

good man.
i hate clib, too...:)

I've found that most of the .exe size comes from exception handling.
Unless you can strip out ALL try/catch stuff, your .exe is probably
gonna stay big...

Otherwise, just set the linker setting to call your startup func
directly instead of the c startup.

Without exception handling (and the other clib stuff), you can
get REAL small .EXEs.

Also, set your linker boundary alignment stuff...

...Steve

 
pixelpajas

February 22, 2005, 02:43 PM

No problem there man.. my barebone ddraw+mygfxlib exe's with a are like 5k uncompressed and like 750 bytes after a dropper2 compression =)


my only problem right now to be solvet the virtual classes issue. at least it seems to relate to virtual classes. but im pretty close to a solution i think.

cheers
//iman

 
Fabian 'ryg' Giesen

February 22, 2005, 03:24 PM

The vtable IS used for RTTI. In fact, this is one of the very few areas in which the C++ standard goes down to what is basically implementation details, by stating that RTTI is only supported for custom classes which have a vtable.

Anyway, there should be no reference to that symbol when you disable RTTI; however, the VS 2005 Beta GUI isn't really in synch with the compiler. Some default compiler options changed between VS.NET 2003 and 2005, and the GUI still assumes VS 2003 defaults and generates no command line switches when you select what is the default setting for VS 2003.

Try adding the command line parameter to disable RTTI manually.

 
pixelpajas

February 23, 2005, 03:36 AM



Fabian. You are, I dunno how else to put it... A GOD.
Thanks mate. I was missing the /GR- flag. =P

It sure is a pain to move from C to C++ sometimes.

 
stephenhazel

February 23, 2005, 02:42 PM

make a .map file and see what's suckin the thing in.
my bet is that it's some kinda exception handling stuff...
can't remember tho...

...Steve

PS - you a game developer? just curious.
Is that compression thing ya mention free?

I'm a boring db developer workin on a midi sequencer at home.
Always nice to meet another win32'er...:)

 
pixelpajas

February 24, 2005, 08:30 AM

> PS - you a game developer? just curious.

Nope. I'm an electronics engineering student that likes to do
graphical effect (mostly 2d) on my sparetime. =)


> Is that compression thing ya mention free?

What compression tool ? You mean cabdropper ? no its free.
take a look: http://gem.intro.hu/


> Always nice to meet another win32'er...:)

It sure is. =)
But im actually pretty new at doing win32.


cheers
//iman

 
This thread contains 11 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.