Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Facility to load dynamic libraries  (Read 9625 times)

0 Members and 2 Guests are viewing this topic.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: Facility to load dynamic libraries
« Reply #15 on: February 05, 2015, 08:43:31 pm »
There is no reason for additional loaders,  you can just use char array and loadFromMemory or create image from pixels.
There is also no type safety at all, so there is no (sane) way to do this:
initfuncsig init = plugin.getFunction("init");
But this should be possible:
initfuncsig init = plugin.getFunction<initfuncsig>("init");
There's no real difference, considering no matter what, you'll get a void pointer that you have to cast. Whether you do that inside our outside your retrieval function doesn't matter.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Facility to load dynamic libraries
« Reply #16 on: February 05, 2015, 08:51:52 pm »
Yes, but your code had no cast at all ;)

And since this particular cast has to be ugly, it's better hidden inside the function anyway.
Laurent Gomila - SFML developer

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: Facility to load dynamic libraries
« Reply #17 on: February 05, 2015, 11:37:00 pm »
Okay, let's use T sf::BrownPaperBag.use<T>(const sf::string &name) then. :P