Re: Can't find a DLL when run from Debug

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Sun, 9 Apr 2006 21:18:42 -0400, "Richard Lewis Haggard"
<HaggardAtWorldDotStdDotCom> wrote:

Thanks guys. I appreciate your input.

I never did figure out how to set a working directory in the project so I
just put an absolute path of the DLLinto the VB interface to DLL definition.

ChDir App.Path

Or tinker with the Path statement in the Environment Strings

This would be intolerable in a commercial project since it would lock the
project into always looking in a hard coded place for the DLL but this is a
development project, so I can get away with such sloppy practices.

There were multiple things I had to do to enable the VB program to find the
function in the DLL. Both the calling convention and the C++ propensity to
mangle names had to be addressed.

In the CPP code, the function is defined as:
BSTR _stdcall GetErrorString(SA_Status code, SA_Status* pStatus)

There are a couple of ways to disable C++ name mangling, but the easiest is
by putting the function export into the DEF file

;LIBRARY "SA_Sockets.dll"
DESCRIPTION 'SA Sockets Library'
EXPORTS
GetErrorString

.



Relevant Pages

  • Re: Cant find a DLL when run from Debug
    ... Richard Lewis Haggard ... I never did figure out how to set a working directory in the project so I ... just put an absolute path of the DLLinto the VB interface to DLL ...
    (microsoft.public.vb.general.discussion)
  • Re: LoadLibrary failed
    ... Neither the absolute path nor the 'dll' in the exe folder worked. ... I used Dependency Walker, which shows that the coredll.dll, commctrl.dll ... Firstly, this should be LoadLibraryW(), just to be correct. ...
    (microsoft.public.windowsce.app.development)
  • Re: LoadLibrary failed
    ... Neither the absolute path nor the 'dll' in the exe folder worked. ... Firstly, this should be LoadLibraryW(), just to be correct. ... Other than that, it can be that the DLL is found, but a dependency isn't, ...
    (microsoft.public.windowsce.app.development)
  • Re: trouble with JNI
    ... System.load allows you to specify the absolute path ... > I'm running the simple HelloNative JNI example from Core Java vol II. ... I've made the dll for the C-routine and compiled ...
    (comp.lang.java.programmer)
  • Re: bash: relative to absolute path
    ... > I started to device a path parser, but then found this cheezy but ... Does anyone have a more efficient/better solution? ... sub-shell that cannot change the working directory of the parent shell. ... Given that a file may not have a _unique_ absolute path, ...
    (comp.unix.programmer)