Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: W8127 Function defined with different linkage, new ActiveX Library


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Dec 4, 2014 4:43 AM Last Post By: Tomas Halvarsson
Matt McNabb

Posts: 21
Registered: 6/9/11
W8127 Function defined with different linkage, new ActiveX Library  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 3, 2014 5:49 PM
In XE5: File > New > Other > ActiveX library. Building generates:

[bcc32 Warning] Project1.cpp(28): W8127 Function defined with different linkage
[bcc32 Warning] Project1.cpp(40): W8127 Function defined with different linkage
[bcc32 Warning] Project1.cpp(61): W8127 Function defined with different linkage
[bcc32 Warning] Project1.cpp(87): W8127 Function defined with different linkage
[bcc32 Warning] Project1.cpp(113): W8127 Function defined with different linkage
[bcc32 Warning] Project1.cpp(118): W8111 Accessing deprecated entity '_fastcall StrIComp(const char *,const char *)'

The W8111 is a known bug, QC#117268. However I could not find any QC report for the W8127 warnings. The warning comes from this discrepancy:

Project1.cpp:
STDAPI __export DllCanUnloadNow(void)

objbase.h:
STDAPI DllCanUnloadNow(void);

(and there's one warning for each of the DLL entry points marked with __export).

Is this a bug that objbase.h doesn't export them when it should? Can I safely ignore this warning?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: W8127 Function defined with different linkage, new ActiveX Library  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 3, 2014 6:33 PM   in response to: Matt McNabb in response to: Matt McNabb
Matt wrote:

[bcc32 Warning] Project1.cpp(28): W8127 Function defined with
different linkage

That means the declaration and definition of a function differ in how they
are linked. That uually happens if the declaration was compiled in the "C"
language, but the definition was compiled in the "C++" language instead,
or vice versa. That usually means you have a missing 'extern "C"' block
somewhere, or maybe an added 'extern "C++"' block. In this case, I would
guess that a needed 'extern "C"' is missing.

Is this a bug that objbase.h doesn't export them when it should?

No. It has never exported them. That is not its job to do.

Can I safely ignore this warning?

I wouldn't. Code from different programming languages is being mixed together
in an inappropriate way. Better to fix the error to avoid any surprises.

--
Remy Lebeau (TeamB)
Matt McNabb

Posts: 21
Registered: 6/9/11
Re: W8127 Function defined with different linkage, new ActiveX Library  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 3, 2014 7:00 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:

I wouldn't. Code from different programming languages is being mixed together
in an inappropriate way. Better to fix the error to avoid any surprises.

Can you suggest a fix?

This code is the code generated by "New > Other > ActiveX > ActiveX Library" in XE5 , I haven't made any changes.
Larry Wasik

Posts: 1
Registered: 9/13/02
Re: W8127 Function defined with different linkage, new ActiveX Library  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 24, 2014 2:43 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Matt wrote:

[bcc32 Warning] Project1.cpp(28): W8127 Function defined with
different linkage

That means the declaration and definition of a function differ in how they
are linked. That uually happens if the declaration was compiled in the "C"
language, but the definition was compiled in the "C++" language instead,
or vice versa. That usually means you have a missing 'extern "C"' block
somewhere, or maybe an added 'extern "C++"' block. In this case, I would
guess that a needed 'extern "C"' is missing.

Is this a bug that objbase.h doesn't export them when it should?

No. It has never exported them. That is not its job to do.

How about fixing the actual problem instead of a useless response.

Can I safely ignore this warning?

I wouldn't. Code from different programming languages is being mixed together
in an inappropriate way. Better to fix the error to avoid any surprises.

--
Remy Lebeau (TeamB)
Tomas Halvarsson

Posts: 2
Registered: 4/6/06
Re: W8127 Function defined with different linkage, new ActiveX Library  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 4, 2014 4:43 AM   in response to: Matt McNabb in response to: Matt McNabb
Found this thread when searching for W8127.

I have exactly the same warnings with XE6. Create a new ActiveX Library and then add an Active Form, save and build it. No more code or anything else added, and these warnings will show up.

Tomas
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02