Watch, Follow, &
Connect with Us
Public Report
Report From: CodeCentral    [ Add a report in this area ]  
Report #:  131585   Status: Reported
Embarcadero XE7 - Problem when exporting a C interface in 64 bit
Project:  CodeCentral Build #:  XE7
Version:    1.0 Submitted By:   Ignasi Mateos
Report Type:  Basic functionality failure Date Reported:  5/20/2015 3:11:16 AM
Severity:    Serious / Highly visible problem Last Updated:
Platform:    64 Bit Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
I have a dll-ready interface done in XE7 that I want to use in Visual Studio 2013.
In 32 bits works fine, but in 64 bit I'm getting an exception when trying to call any method of the interface class.

The Embarcadero XE7 project is like this:


class Interface

{


public:



virtual ~Interface() { }



virtual void Member1() = 0;

};


class Impl : public Interface

{


public:



virtual void Member1() { }

};



Impl* Impl::GetInstance()

{


static Impl instance;


return &instance;

}


extern "C" Interface* _stdcall _export GetImplementation()

{


return (Interface*)Impl::GetInstance();

}


In Visual Studio I do something like:




typedef  Interface* (_stdcall GetImpl) ();



HMODULE hHandle = LoadLibrary(...);

GetImpl *fGetImpl = NULL;



fGetImpl = (GetImpl*)GetProcAddress(hHandle, "GetImplementation");



if (fGetImpl)

{


Interface *pInterfase = fGetImpl();


if (pInterfase)


{



pInterfase->Member1();


}

}


I have no idea why crashes in 64bit.

Thanks in advance.

Ignasi
Steps to Reproduce:
None
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01