• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Fwd: Question about weak linking?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Question about weak linking?


  • Subject: Fwd: Question about weak linking?
  • From: Trenton Schulz <email@hidden>
  • Date: Thu, 6 May 2004 09:33:31 +0200

Hi,

Someone from carbon-development suggest I pass this along to the Xcode-Users list, so here you go:

Begin forwarded message:

Let's say I have this program where I'm trying to do weak linking:

#include <Carbon/Carbon.h>

void use_secure_keyboard(bool b)
{
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
    if(b) {
        if (EnableSecureEventInput)
            EnableSecureEventInput();
    } else {
        if (DisableSecureEventInput)
            DisableSecureEventInput();
    }
#else
    (void*)b;
#endif
}

int main()
{
    use_secure_keyboard(true);
    return 0;
}

Now if I compile this program as a C program it works fine. But if I compile it as a C++ program I get this messages:
main.cpp: In function `void use_secure_keyboard(bool)':
main.cpp:7: warning: the address of `OSStatus EnableSecureEventInput()', will
always be `true'
main.cpp:10: warning: the address of `OSStatus DisableSecureEventInput()', will
always be `true'


And sure enough, if you run it on Jaguar it does crash.

I'm guessing it might possibly be the name mangling, but it comes from Carbon so it should know EnableSecureEventInput is a C function.

Is there anything obvious/non-obvious I'm missing? I really need to this to work inside a C++ context.

Thanks in advance,

-- Trenton Schulz Trolltech AS _______________________________________________ xcode-users mailing list | email@hidden Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Question about weak linking?
      • From: Glen Low <email@hidden>
    • Re: Question about weak linking?
      • From: Philip Aker <email@hidden>
  • Prev by Date: Re: OT: mail and homepage.mac.com
  • Next by Date: Re: OT: mail and homepage.mac.com
  • Previous by thread: vrsave woes
  • Next by thread: Re: Question about weak linking?
  • Index(es):
    • Date
    • Thread