🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

DLL GetProcAddress problem

#16377
From: Enrico B.
Date: Tue, 20 May 2003 08:19
42 lines
1828 bytes
Hi to all!

I am working on the following piece of code:

-----------------------------------------------------
#define TXDEVICE_API extern "C" __declspec(dllexport)

int (*Txdevice_init)();

void __fastcall TForm1::Button1Click(TObject *Sender)
{ HINSTANCE hndr;

  hndr = LoadLibrary("Txdevice.dll");

  if (!hndr)
  {
    Edit1->Text = "DLL Loading Error";
    return;
  }

  Txdevice_init = (int (*)(void))GetProcAddress(hndr, "Txdevice_init");

  if (!Txdevice_init)
  {
    Edit1->Text = "DLL GetProcAddr Error";
    return;
  }

  // go on working ...
}
-----------------------------------------------------

I am pretty sure the "Txdevice.dll" does contain the routine
"Txdevice_init"; in spite of that the instruction:

Txdevice_init = (int (*)(void))GetProcAddress(hndr, "Txdevice_init");

always returns zero.
Is there something wrong in my code?
Thanks in advance.

Henry
Technical Details
Message-ID: <3ec9e11d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,103aeaad97b09526,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-20 01:12:06 PST
Reply-To: "Enrico B." <eangelo@libero.it>
From: "Enrico B." <eangelo@libero.it>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: DLL GetProcAddress problem
Date: Tue, 20 May 2003 10:19:23 +0200
Lines: 45
Organization: Idinet
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
NNTP-Posting-Host: 212.38.41.32
Message-ID: <3ec9e11d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1053417757 212.38.41.32 (20 May 2003 01:02:37 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail