• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By BillyGD

      Play Flick Football 3D @ https://gamejolt.com/games/flickfootball3d/326078
      Check out our Facebook page @ https://www.facebook.com/FlickFootball3D/
      Flick Football 3D is a turn based football game inspired by the table top classic 'Subbuteo'.
      The game is currently in very early Alpha development. There is still a lot to be done before the first proper release but I have decided to release this playable version to get as much feedback as possible.
      The only game mode currently available in this release is the 'Practice Mode' which gives you control of both teams. Either play against yourself to get used to how the game works or play against friends and family on the same computer!
      Planned Future Features Include:
      -Take control of your own custom team in the single player campaign.
      -Play in online leagues and tournaments against other players in the multiplayer mode.
      -Fully customisable stadiums to make you stand out from the rest of the players.
      -Improve your players stats and skills by playing matches and setting up training sessions.
      Flick Football 3D is available for Windows, Mac and Browser.
      Thank you for viewing my game, all feedback is greatly appreciated. I can be contacted at; BillyGDev@outlook.com
      'Flick Football 3D' is also the development name for the game and I haven't yet decided what the full release will be called, so if you have any ideas please drop me a message!
    • By drcrack
      It is a combination of fundamental RPG elements and challenging, session-based MOBA elements. Having features such as creating your unique build, customizing your outfit and preparing synergic team compositions with friends, players can brave dangerous adventures or merciless arena fights against deadly creatures and skilled players alike.

      This time with no grinding and no pay to win features.

      We're still looking for:
      1) 3D Character Artist
      2) 3D Environment Artist
      3) Animator
      4) Sound Designer
      5) VFX Artist

      Discord https://discord.gg/zXpY29V or drcrack#4575
    • By Francisco Tufr
      Hi everyone! I'm currently working on a series of books about 2D Shader Development.

      The idea is to synthesize a bunch of techniques that are specifically useful for 2D, even if they work on 3D as well.

      I released the first book last week. It's 4.99 on Amazon or free on the series website, https://www.2dshaders.com

      This is an independent initiative, I don't work for any publisher whatsoever. The contents of the books are the result of a 4-year span where I started teaching this in Argentina and USA, always making the workshop better. Now I'm expanding it to make more sense in book form.

      I'd love to hear your opinions on the idea and if you get the book let me know what you think.

      By the way, the examples are in Unity, but the concepts from the book should be easily transferable to any graphics api/engine.

      Hope you like it!
    • By RoKabium Games
      While looking out for that pesky Terrator, our little alien is doing a bit of relaxed mining down on the new gas planet "Lelantos" this weekend.... 
      #gamedev #indiedev #madewithunity #screenshotsaturday
    • By vividgamer
      I have a native iOS game (objective c, XCode build) which I am considering to port to other platforms.
      Core gameplay is based on solely on geographical maps, and custom drawing over maps. It also has Core Data. This part is complete in development.
      What is not done yet is: monetization, gamification (leaderboards, challenges) and multiplayer functionality.
      As I think more about it, I am tempted to think if this is the right time to move to a cross platform tool such as Unity. But before dedicating time to port my 5 years side-project effort in Objective C, I really want to know if its worth it.
      - Does Unity support such plugins / assets that will fulfill all my above requirements?
      - Unity Personal seems to have only 20 concurrent users - is it too costly scaling if I decide for extending to web and android platforms?
      - What is the general workflow involved in publishing to iOS, Android, PC, and web platforms while using Unity? I mean to ask about various points of signing stuff, paying fees and getting certified.
      - How long will it really take to port my entire Objective C project into Unity? I am somewhat familiar with C# but I am finding it hard fidgeting with Unity IDE as lot of things are focused around FPS and 3D while my game is still 2d - not much action involved. I seem bit overwhelmed by the list of features I see there. All in all, I do not want to lose my momentum while still making sure its portable to everywhere.
      - Any assets I could use (for free to try basis in debug) that are relevant for my game?
      - Last but not the least, are there any costs that I need to be paying upfront to Unity, for using it (apart from their monthly subscription model)? I don't understand their costing for multiplayer in conjunction with their subscription fees - if someone could kindly elaborate.
      Thanks in advance for your time reading a newbie
  • Advertisement
  • Advertisement
Sign in to follow this  

Unity MSVC static lib linking culls some code?

This topic is 2685 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I use macros in quite a few places for classes that need to be created based on their name or ID. It's useful for scripting, serializing and when networking our game. It's basically a dummy struct with a constructor that is initialized before main.


#define IMPLEMENT_OBJECT(name) struct name##Creator { name##Creator () { ObjectManager::addObject (#name, new name); } }; name##Creator name##CreatorInstance;

(Had to modify the source above to a quote or it would screw up the formatting of the page)

Ugly perhaps, but these work great in .cpp files in all cases so far, but today I decided to branch them out into their own lib because I use them in so many projects.

So it seems that if I put one in a .cpp file that contains a class that is never referenced anywhere else, it won't get called at all even though it's actually referenced in the macro itself. This happens only when in the library, and not in the projects themselves so it's not very consistent.

Putting the macro "call" in a .h file that is included didn't help. I have to actually reference the class in those files for the dummy initializer to run.

I know about the compiler option, but is there a pragma or reference trick that I can use to make the library .cpp file compiled and used in all cases like it does in my project?

It's the same issue mentioned here:

And there are a few mentioned "solutions" though the last one doesn't work and it's still unreferenced. The pragma also didn't work, it finds the symbol but it's not referencing it (since the code still isn't executed).

This is how I tested it:

struct Test
Test ()
MessageBoxA (NULL, "Test", "It works!", MB_OK);
Test TestInstance;

#pragma comment(linker,"/include:TestInstance")


Global Compiler/Linker options have no effect.

Thank you for any suggestions!

[Edited by - SymLinked on November 12, 2010 2:09:18 AM]

Share this post

Link to post
Share on other sites
Ah, this wonderful bug. I don't think there is any real solution, but there is a workaround:

1) Add a:
void doAbsolutelyNothing() { }
function in the same source file as the instances of the objects you are creating. If you have multiple source files with instances, you'll need multiple functions with different names.

2) Call this:
function from some other part of your source, such as in initialization code, or code which is only called once.

The VC linker doesn't include object files in the final .exe with no external references as it assumes they're never used (it's apparently not smart enough to notice that object variables are simply instanced in that compilation unit). By adding an external reference, you force the inclusion of that object in the linker.

You could optionally make a variable reference to your TestInstance from some other part of your source which would work just as well, but since you're generating these names with macros, that seems like it would be much more difficult for you.

Share this post

Link to post
Share on other sites
It's not a bug. This is related to dynamic initializers.

Gory details for the GNU linker, but the idea seems to be the same for the Visual C++ linker in my experience.

Have you tried passing /OPT:NOREF to the linker? (Though beware of dragging in lots of other bloat).

Share this post

Link to post
Share on other sites
Original post by SymLinked]Ugly perhaps, but these work great in .cpp files in all cases so fars ...

That is not far from my description of a hack and sometimes when you play with fire you do get burnt.

You are relying on the static initialisation of an object which may not be used, to access global (probably) state in ObjectManager::addObject.

Original post by SymLinkedThank you for any suggestions!

You may not like it but fix the source of the problem not the current problem.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement