Article View: borland.public.cppbuilder.nativeapi
Article #4887Re: dll entry point
From: Pawel Tatera
Date: Wed, 09 Nov 2005 17:01
Date: Wed, 09 Nov 2005 17:01
74 lines
2749 bytes
2749 bytes
Hi.
Download this: ftp://pa80.chodziez.sdi.tpnet.pl/pub/project/dll_class.zip
Remove the exe and dll into other place and run make to make new
compilation.
(hope it will work for you)
This is a sample how to create a dll with a a class and a single function
inside it,
and a simple console app that will load this dll at the start and print the
output in the console window.
Sorry but I don't have an access to BCB, simply using free commandline
version
I'll do my best to make some Windows stuff for you. I'm not the expert - I'm
learning too ;)
PawelT
#define DLL_IMP __declspec(dllimport) // You don't realy
need this.
> #define DLL_EXP __declspec(dllexport)
>
> #pragma argsused
>
> void DLL_EXP ShowForm(void)
> {
> TDllForm *NewForm=new TDllForm(NULL);
> try
> {
> NewForm->ShowModal();
> }
> __finally
> {
> NewForm->Free();
> }
> }
>
> BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID
lpvReserved)
> {
> return 1;
> }
>
//--------------------------------------------------------------------------
-
>
> and the code of the test project...
>
> #include <stdlib.h>
> #define DLL_IMP __declspec(dllimport)
> #define DLL_EXP __declspec(dllexport)
>
> extern DLL_IMP FormShow(void);
>
> int main(int argc, char* argv[])
> {
> FormShow();
> system("pause");
> return 0;
> }
>
//--------------------------------------------------------------------------
-
>
> This second project contains the lib from the first and the dll beside
> it. The thing is that somehow it cannot be linked.
>
> [Linker Error] Unresolved external 'FormShow()' referenced from E:\DLL
> PROJECT\TEST\TEST.OBJ
>
> What am i doing wrong?
Technical Details
Message-ID:
<43722c42@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<43712644$1@newsgroups.borland.com> <4371283c@newsgroups.borland.com> <4371dede$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ca4d130f24202b65 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Pawel Tatera" <paweltatera@pa80.chodziez.sdi.tpnet.pl> Newsgroups: borland.public.cppbuilder.nativeapi References: <43712644$1@newsgroups.borland.com> <4371283c@newsgroups.borland.com> <4371dede$1@newsgroups.borland.com> Subject: Re: dll entry point Date: Wed, 9 Nov 2005 18:01:14 +0100 Lines: 76 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 217.97.16.80 Message-ID: <43722c42@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1131555906 217.97.16.80 (9 Nov 2005 09:05:06 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail