From: Gunther Ebert <gunther.ebert@ixos-leipzig.de>
To: Tim Newsham <newsham@aloha.net>
Cc: gnu-win32@cygnus.com
Subject: Re: undefined reference
Date: Tue, 14 Oct 1997 04:29:00 -0000 [thread overview]
Message-ID: <34434031.590@ixos-leipzig.de> (raw)
In-Reply-To: <199710140049.OAA26629@haleakala.aloha.net>
Tim Newsham wrote:
>
> Hi,
>
> I found a reference to a function named "NetEnumerateTrustedDomains"
> and wanted to use it. I found it listed in the microsoft headers
> in <LMACCESS.H> as:
>
> NTSTATUS
> NetEnumerateTrustedDomains (
> IN LPWSTR ServerName OPTIONAL,
> OUT LPWSTR *DomainNames
> );
>
> so I made a test case using:
>
> #include <windows.h>
>
> DWORD STDCALL NetEnumerateTrustedDomains(LPWSTR, LPWSTR *);
> [... some code ...]
>
> but when I went to link it I got an unresolved error:
>
> C:\TEMP\cc0010491.o(.text+0x36):doms.c: undefined
> reference to `NetEnumerateTrustedDomains@8'
>
> so I checked through the libnetapi32.a and found it missing:
>
> % nm libnetapi32.a |grep NetEnum
> [nothing]
>
It is really not there. You will either have to build a new import library
for netapi32.dll. Look for netapi32.def in the CDK source tree (winsup/sysdef I believe)
and add a line
NetEnumerateTrustedDomains@8
without any @xx stuff. If the other function names in the netapi32.def file
have preceding underscores add one also the new line.
Build the import library by executing dlltool:
dlltool -k --dllname netapi32.dll --output-lib libnetapi32.a --def netapi32.def
If the functions names in netapi32.def have preceding underscores add
the '-U' option to the dlltool command line.
> If I look at the netapi32.dll in quikview, its in there:
>
> Export Table
> Ordinal Entry Point Name
> 0044 00010786 NetEnumerateTrustedDomains
>
> So the questions
>
> - why isnt this function in the generated .a?
It has probably been forgotten, perhaps because this function isn't documented
at least in the MSDN library.
> - how is it decided which functions are put into the generated .a's?
One has to write the import definition files manually.
> - can I call this function without building a new .a? or can
> I generate a minimal .a that will let me call this function?
I think it doesn't make much sense to create a new minimal import library
for just one function. Create a new libnetapi32.a library instead.
However, you can call this function also without creating a new import library
(error checking code omitted):
typedef DWORD STDCALL (*fntype)(LPWSTR, LPWSTR *);
void foo(LPWSTR servername, LPWSTR *domains)
{
HANDLE hNetApiDLL = LoadLibrary("netapi32.dll");
fntype fptr = (fntype)
GetProcAddress(hNetApiDLL, "NetEnumerateTrustedDomains");
(*fptr)(servername, domains);
}
> - how can I make a new libnetapi32.a that has this function referenced?
described above
>
> Tim N.
>
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".
--
Gunther Ebert
iXOS Anwendungs-Software GmbH
Angerstrasse 40-42
D-04177 Leipzig
Phone : +49 341 48503-0
Fax : +49 341 48503-99
E-mail: mailto:gunther.ebert@ixos-leipzig.de
www : http://www.ixos-leipzig.de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
next prev parent reply other threads:[~1997-10-14 4:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-13 19:00 Tim Newsham
1997-10-14 4:29 ` Gunther Ebert [this message]
1997-10-14 19:54 ` Tim Newsham
1999-05-17 16:53 Undefined Reference dale henderson
1999-05-31 21:10 ` dale henderson
[not found] <1dbb5dd90906251156v6fec5ffbx749d7d0ce7914b07@mail.gmail.com>
2009-06-26 14:14 ` Fwd: undefined reference Winderson Martins de Souza
2009-06-27 1:20 ` Sisyphus
2009-07-01 13:54 ` Winderson Martins de Souza
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34434031.590@ixos-leipzig.de \
--to=gunther.ebert@ixos-leipzig.de \
--cc=gnu-win32@cygnus.com \
--cc=newsham@aloha.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).