🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2899

Re: How to call function from 'DLL calling application' inside DLL

#2899
From: bunny
Date: Thu, 22 Jun 2000 00:00
46 lines
2822 bytes
__declspec(dlllexport) for the class in your exe
__declspec(dllimport) for the class in your dll

The difficulty is the mutual dependancy makes linking a pain because the exe
needs the dlls lib and the dll needs the exes lib. Here what you do...

link the exe and it will fail because the import .lib for the dll doesnt exist
but it will create the import lib for the exe anyways
link the dll and it will link properly using the exes import lib and also
generate the  import lib for the dll
link the exe again this time it can succeed because the import lib for the dll
is there.

JpJ wrote:

> Soory, you probably can't. First off, why create a "custom" DLL? Just
> include that DLL code in your main programs source, because there's not much
> use in having a DLL that is only good for one program. But if you plan to
> use the DLL elsewhere, you will have to include your main program's source
> in the DLL (or at least the part needed by the DLL.)
>
> The jist of it is that your not going to be able, as far as I know, to call
> your main program's member functions unless they are defined in the DLL
> itself.
>
> JpJ <><
>
> Miladin Sajic <sajicm@eunet.yu> wrote in message
> news:3906CD50.501C34D9@eunet.yu...
> > Hi,
> >
> > I have got an C++ application and a DLL.  I use DLL function from my
> > application without any problems but I want to call some calling
> > application's functions from DLL. How to solve that ?
> >
> > Actually, needed functions are member functions from an object. I made
> > new DLL function and I put pointer on my object as argument of new
> > function. But  I don't know how to made DLL to understand my pointer. I
> > included app. header but I can't compile dll because called functions
> > isn't implemented in dll. Obviously, I must import that functions or
> > class from application. How to do that ?
> >
> > Miladin.
> >
> >
> >
Technical Details
Message-ID: <3951DF98.46A7A247@eidosnet.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3906CD50.501C34D9@eunet.yu> <7cf45.10889$UT.631886@nntp1.onemain.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 105df1,1c746b8a3e0e7577
X-Google-Attributes: gid105df1,public
X-Google-Thread: 103bde,1c746b8a3e0e7577
X-Google-Attributes: gid103bde,public
From: bunny <xbunny@eidosnet.co.uk>
Subject: Re: How to call function from 'DLL calling application' inside DLL
Date: 2000/06/22
Message-ID: <3951DF98.46A7A247@eidosnet.co.uk>
X-Deja-AN: 637558834
Content-Transfer-Encoding: 7bit
References: <3906CD50.501C34D9@eunet.yu> <7cf45.10889$UT.631886@nntp1.onemain.com>
X-Accept-Language: en,pdf
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@eidosnet.co.uk
X-Trace: quince.news.easynet.net 961666772 3367 212.134.24.149 (22 Jun 2000 09:39:32 GMT)
Organization: [posted via Eidosnet]
Mime-Version: 1.0
NNTP-Posting-Date: 22 Jun 2000 09:39:32 GMT
Newsgroups: comp.os.ms-windows.programmer.misc,borland.public.cpp.winapi