Welcome, Guest. Please login or register.

Author Topic: C++ shared libs?  (Read 4408 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: C++ shared libs?
« on: December 05, 2012, 11:23:30 PM »
I don't want to rain on anybody's parade, but if C++ classes are being exposed via AmigaOS shared libraries then I fully expect it to work for trivial concrete classes only. Either that, or you write your library functions based on some C structure that then becomes embedded as a delagate within a C++ class wrapper in which a bunch of inline method calls trampoline into your LVO.

I really can't see proper C++ shared code working that way. Not when you factor in things like inheritence, polymorphism and templating. Especially templating...
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: C++ shared libs?
« Reply #1 on: December 06, 2012, 12:53:56 AM »
Quote from: vidarh;717715
Templating is one of the lesser evils since it's compile time, and in headers


Not always. It's pretty common practise to provide template specialisations that are compiled once and used as a common base for multiple types. For example, you create some container type. Every MyContainer implementation can be reduced to a specialisation for void*, in which the remaining template just becomes a type safety wrapper. It's a well recognised strategy to avoid template bloat.
int p; // A