🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5082

Re: dll entry point

#5082
From: qyte
Date: Wed, 09 Nov 2005 11:35
79 lines
2873 bytes
Pawel Tatera wrote:
> Hi
> 
> Try this inside your cpp file that will be compiled as dll
> 
> BOOL WINAPI DllEntryPoint(HINSTANCE, DWORD, LPVOID){
>   return TRUE;
> }
> put any new functions here that will be inside your dll
> 
> 
> Wou will also need something like this in another header file:
> 
> #define DLL_IMP __declspec(dllimport);
> #define DLL_EXP __declspec(dllexport);
> 
> int DLL_EXP WINAPI YourFinction(int, char*, and_so_on);
> 
> 
> PawelT
> 

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?
Technical Details
Message-ID: <4371dede$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43712644$1@newsgroups.borland.com> <4371283c@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
Date: Wed, 09 Nov 2005 13:35:42 +0200
From: qyte <gyte@vivodinet.gr>
User-Agent: Thunderbird 1.5 (Windows/20051025)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: dll entry point
References: <43712644$1@newsgroups.borland.com> <4371283c@newsgroups.borland.com>
In-Reply-To: <4371283c@newsgroups.borland.com>
Content-Type: text/plain; charset=windows-1253; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 83.171.210.195
Message-ID: <4371dede$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1131536094 83.171.210.195 (9 Nov 2005 03:34:54 -0700)
Lines: 79
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail