🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Dll conversion

#16902
From: Greg Brewer
Date: Sun, 20 Apr 2003 04:30
208 lines
5198 bytes
Your problem is
// These are the two structs that are exported from the DLL
//
typedef struct IMPORTTABLE
{
    struct
    {
        ID fnID;
        PVOID fnPtr;
    } dummy;
} IMPORTTABLE;

You have defined a typedef named IMPORTTABLE and a struct named IMPORTTABLE;
apparently MSVC6 doesn't consider it a problem.  I would suggest you change
it to either
// These are the two structs that are exported from the DLL
//
typedef struct IMPORT_TABLE
{
    struct
    {
        ID fnID;
        PVOID fnPtr;
    } dummy;
} IMPORTTABLE;

or better yet
// These are the two structs that are exported from the DLL
//
struct IMPORTTABLE
{
    struct
    {
        ID fnID;
        PVOID fnPtr;
    } dummy;
};

same for the other duplicate.



"Victor G. Baron" <vgbaron@hotmail.com> wrote in message
news:8060av8s89u8f5k4ujv19bfoh4nd4j5315@4ax.com...
> Hi -
>
> The following code compiles in MSVC6 and creates a DLL that is loaded by
another
> program. I need help doing several things -
>
> 1) get it to compile in BCB5
> 2) Set a system hook for the keyboard
> 3) Display a form from within the dll
>
> #2 I can figure out but when I try to compile in BCB5 I get an error "
Multiple
> declaration for LINKAGE" and the same for IMPORT TABLE.
>
> How do I get by this?
>
> And most important, can I use VCL to create the form and then how to
display?
>
> Any help appreciated.
>
>
> Vic Baron
>
> <------------------code--------->
>
>
> //FSMODULE.H
>
>
> //
> // Example Microsoft Flight Simulator 2002 Module
> //
> // Copyright 2001-2002 Joel M. DeYoung
> // This code may be freely distributed and modified provided this notice
> // remains unchanged.
> //
> // This is the minimal amount of code required to get Microsoft Flight
Simulator
> // to load a DLL that is placed in the modules subdirectory under the main
> // FS directory.
> //
>
>
> #ifndef FSMODULE_H_
> #define FSMODULE_H_
>
> #include <windows.h>
>
>
> // We must specify this alignment directive
> //
> #pragma pack(4)
>
>
> // Some defines
> //
> typedef int ID;
> typedef unsigned int VAR32;
> typedef VAR32 FLAGS32;
> #define FSAPI __stdcall
>
> // These are the functions called when loading and unloading the module
> //
> extern void FSAPI module_init ();
> extern void FSAPI module_deinit ();
>
> // These are the two structs that are exported from the DLL
> //
> typedef struct IMPORTTABLE
> {
>     struct
>     {
>         ID fnID;
>         PVOID fnPtr;
>     } dummy;
> } IMPORTTABLE;
> __declspec (dllexport) IMPORTTABLE ImportTable;
>
> typedef struct LINKAGE
> {
>     ID ModuleID;
>     void (FSAPI *ModuleInit) ();
>     void (FSAPI *ModuleDeInit) ();
>     FLAGS32 ModuleFlags;
>     UINT32 ModulePriority;
>     UINT32 ModuleVersion;
>     LPVOID* Table[];
> } LINKAGE;
> __declspec (dllexport) LINKAGE Linkage;
>
>
> #pragma pack ()
>
>
> #endif
>
>
> <--------------c file code-------------------->
>
> //FSMODULE.C
> //
> // Example Micosoft Flight Simulator 2002 Module
> //
> // Copyright 2001-2002 Joel M. DeYoung
> // This code may be freely distributed and modified provided this notice
> // remains unchanged.
> //
> // This is the minimal amount of code required to get Microsoft Flight
Simulator
> // to load a DLL that is placed in the modules subdirectory under the main
> // FS directory.
> //
>
>
> #include "fsmodule.h"
> #include <windows.h>
>
>
> // The global exported LINKAGE object
> //
> LINKAGE Linkage =
> {
>     0x000002d9,
>     module_init,
>     module_deinit,
>     0,
>     0,
>     0x800,
>     { 0 }
> };
>
> // The global exported IMPORTTABLE object
> //
> IMPORTTABLE ImportTable =
> {
>     {
>         0x00000000, NULL
>     }
> };
>
>
> // This function is called by MSFS when the module is initialized
> //
> void FSAPI module_init ()
> {
>
> // I need to display the window here
>
> }
>
>
> // This function is called by MSFS when the module is unloaded
> //
> void FSAPI module_deinit ()
> {
> }
>
>
>
> --
> Vic Baron
> I haven't lost my mind, it's backed up on disk somewhere!
> UPDATE!!-- I have lost my mind.
Technical Details
Message-ID: <3ea22244$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <8060av8s89u8f5k4ujv19bfoh4nd4j5315@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,5220fd881ef8912f
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-19 21:36:02 PST
From: "Greg Brewer" <Greg@Brewer.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <8060av8s89u8f5k4ujv19bfoh4nd4j5315@4ax.com>
Subject: Re: Dll conversion
Date: Sat, 19 Apr 2003 23:30:23 -0500
Lines: 210
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: 206.180.153.52
Message-ID: <3ea22244$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1050812996 206.180.153.52 (19 Apr 2003 21:29:56 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail