[quoted text, click to view] "Jonathan Chong" <jonathan@3exp.com> wrote in message news:<ezw2kAQrEHA.4080@TK2MSFTNGP10.phx.gbl>...
> "Simon Kissane" <skissane@gmail.com> wrote in message
> news:82fa6638.0410072215.77b87501@posting.google.com...
> > Hi,
> >
> > I try compiling the xp_hello.dll sample using the Visual C++ Toolkit,
> > as follows:
> >
> > cl xp_hello.c /I "C:\program files\microsoft sql
> > server\80\tools\devtools\include" /LD /nologo /MT /W3 /GX /O2 /D
> > "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D
> > "XP_HELLO_EXPORTS" /YX /FD /link /dll /def:xp_hello.def
> > ..\..\..\lib\opends60.lib /machine:I386
> >
> > When I add to the server and then try to call the extended proc
> > xp_hello, I get an error 127 that entry point xp_hello can't be
> > found. But I have checked with depends.exe, and it is being exported
> > from xp_hello! The builtin extended procs (e.g. those in xpstar.dll)
> > all work fine, and running depends.exe on xpstar.dll I can't see any
> > difference between them and xp_hello.dll....
> >
> > Anyone able to help?
> >
> > Thanks
> > Simon Kissane
>
> Have you do these?
> 1. Register it in SQL with sp_addextendedproc command.
> 2. Copy your xp_hello.dll to your SQL Server \Binn directory
Yes, I have copied it to Binn and registered it with
sp_addextendedproc. I know it is loading the DLL, because it gives me
the message:
ODBC: Msg 0, Level 16, State 1
Cannot find the function xp_hello in the library xp_hello.dll. Reason:
127(The specified procedure could not be found.).
Whereas, if I use a non-existent name, e.g. xp_hello2.dll, I get the
different message:
ODBC: Msg 0, Level 16, State 1
Cannot load the DLL xp_hello2.dll, or one of the DLLs it references.
Reason: 126(The specified module could not be found.).
So the problem is not with loading the DLL; rather, it is with finding
the entry point in the DLL. But depends.exe says the entry point is
there.
I have tried both using a .DEF file (the one supplied with the sample
by MS), and with using __declspec(dllexport) before the __GetXpVersion
and xp_hello functions, and neither seems to make a difference. (i.e.
depends.exe reports dll entry point is there, but SQL Server, although
it can find the DLL, it can't find the entry point....)
Thanks