Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Linker    [ Add a report in this area ]  
Report #:  120010   Status: Open
[Win64] TThread methods not exported in Win64 target
Project:  C++Builder Build #:  19.0.13476.4176
Version:    19.0 Submitted By:   Christian Mol
Report Type:  Basic functionality failure Date Reported:  10/25/2013 7:52:48 AM
Severity:    Infrequently encountered problem Last Updated: 10/27/2013 6:24:06 PM
Platform:    All versions Internal Tracking #:   44511
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
A class inheriting from TThread has to be exported into a dll.

When compiling these projects in Win32, everything builds fine, but when building in Win64, a number of methods from the class in the dll are not exported into the dll, resulting in unresolved externals in the application that uses it.
Steps to Reproduce:
1. Build project1 in Win32, build project2 in Win32 -> No errors

2. Build project1 in Win64, build project2 in Win64 -> unresolved external errors
----
[ilink64 Error] Error: Unresolved external 'BaseThread::Execute()' referenced from C:\QC\WIN64\DEBUG\FILE2.O
[ilink64 Error] Error: Unresolved external 'BaseThread::afterExecute()' referenced from C:\QC\WIN64\DEBUG\FILE2.O
[ilink64 Error] Error: Unresolved external 'BaseThread::BaseThread(bool)' referenced from C:\QC\WIN64\DEBUG\FILE2.O
[ilink64 Error] Error: Unresolved external 'BaseThread::setDescription(std::string const&)' referenced from C:\QC\WIN64\DEBUG\FILE2.O
[ilink64 Error] Error: Unresolved external 'BaseThread::getDescription() const' referenced from C:\QC\WIN64\DEBUG\FILE2.O
----
----
#include "Classes.hpp"
#include <string>

#ifdef PROJECT_EXPORTS
  #define PROJECT_API __declspec(dllexport)
#else
  #define PROJECT_API __declspec(dllimport)
#endif

class PROJECT_API BaseThread : public TThread
{
private:
  unsigned long ulId;
  static unsigned long ulIdCount;

protected:
  std::string sName;
  std::string sDescription;
  bool bPaused;
  virtual void __fastcall Execute();
  virtual void threadExecute() = 0;
  virtual void afterExecute();

public:
  __fastcall BaseThread(bool CreateSuspended = true);
  unsigned long id() {return ulId;}
  void setDescription(const std::string &description);
  std::string getDescription() const { return sDescription; }
  void togglePause() { bPaused = !bPaused; }
  bool paused() { return bPaused; }
};
--------
--------
#include "BaseThread.h"

unsigned long BaseThread::ulIdCount;

__fastcall BaseThread::BaseThread(bool CreateSuspended):
  TThread(CreateSuspended), ulId(++ulIdCount)
{

}

void __fastcall BaseThread::Execute()
{
  threadExecute();
  Synchronize(Terminate);
}

void BaseThread::afterExecute()
{

}

void BaseThread::setDescription(const std::string &description)
{
  sDescription = description;
}
----
Workarounds
None
Attachment
qc.zip
Comments

None

Server Response from: ETNACODE01