Article View: borland.public.cppbuilder.nativeapi
Article #4885Re: dll entry point
From: Dennis Jones
Date: Wed, 09 Nov 2005 16:37
Date: Wed, 09 Nov 2005 16:37
71 lines
2678 bytes
2678 bytes
"qyte" <gyte@vivodinet.gr> wrote in message
news:4371dede$1@newsgroups.borland.com...
>
> I have built two projects. One a dll wizard with a form added into it.
> And another that is a console app. The project is purely a test project
> and the Form is currently blank.
>
> Here is the code inside the dll...
> #include <vcl.h>
> #include <windows.h>
> #include "form.h"
> #pragma hdrstop
>
> #define DLL_IMP __declspec(dllimport)
> #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?
The name of the function is wrong. You called your function ShowForm() in
the DLL, but then changed it to FormShow() in the application.
- Dennis
Technical Details
Message-ID:
<4372259b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news-xfer.newsread.com!yellow.newsread.com!netaxs.com!newsread.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: "Dennis Jones" <nospam@nospam.com> 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 08:37:10 -0800 Lines: 73 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 204.200.27.7 Message-ID: <4372259b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1131554203 204.200.27.7 (9 Nov 2005 08:36:43 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news-xfer.newsread.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail