Article View: borland.public.cppbuilder.nativeapi
Article #1757Re: CALLBACK Hell
From: Alan Bellingham
Date: Thu, 14 Jun 2007 16:38
Date: Thu, 14 Jun 2007 16:38
54 lines
2739 bytes
2739 bytes
"Mike Collins" <its@TheBottomOfThePost> wrote:
>extern TInjectController *InjectController;
Declaration.
>// implimentation
>void CALLBACK TInjectController::IPCProcessMsg(char *cName, void *pMsgBuf,
>unsigned int iMsgLen,
> void *pRtnBuf, unsigned int
>iRtnLen)
>{
> InjectController->csIPCCallBack->Enter();
> ...
> InjectController->csIPCCallBack->Leave();
>}
Use.
>- I've declared the callback function as static and stuck in the extern
>reference at the bottom of the class. I did this because it's the only way
>that i found that works in the past, with other callbacks i.e. EnumWindows
>etc...
>
>However, on compile i get "[Linker Error] Unresolved external
>'_InjectController' referenced from C:\DOCUMENTS AND
>SETTINGS\ADMINISTRATOR\DESKTOP\TEST
>INJECTOR\TINJECTCONTROLLER\TINJECTCONTROLLER.OBJ"
Complaint about lack of definition.
You're trying to call methods of an object that doesn't exist anywhere
in your source code. You told the compiler that it would exist in some
source file somewhere, but you don't seem to have actually declared it
anywhere.
>If i remove the reference to the wrapper from within the callback, it works
>fine - but defeats the object and breaks my design.
Well, yes.
>Can anyone help me out here? Also, can anyone tell me why the extern
>reference seems to be necessary >
It's not necessary at all. But if you declare it *in the header* without
an extern, then it's a definition as well as a declaration, and it will
exist in every single source file that uses that header.
Do you initialise the pointer either?
Alan Bellingham
--
Team Browns
ACCU Conference 2008: 2-5 April 2008 - Oxford (probably), UK
Technical Details
Message-ID:
<agr2731rl90vspqaucjmhlk7e2al16e028@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!217.73.144.44.MISMATCH!ecngs!feeder.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46716c33@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f434271506d1483b X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Alan Bellingham <alan@lspace.org> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: CALLBACK Hell Date: Thu, 14 Jun 2007 17:38:21 +0100 Organization: Private Reply-To: alan@lspace.org Message-ID: <agr2731rl90vspqaucjmhlk7e2al16e028@4ax.com> References: <46716c33@newsgroups.borland.com> X-Newsreader: Forte Agent 4.2/32.1118 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 193.129.251.253 X-Trace: newsgroups.borland.com 1181839100 193.129.251.253 (14 Jun 2007 09:38:20 -0700) Lines: 54 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!217.73.144.44.MISMATCH!ecngs!feeder.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail