Re: Cannot open include file:problem with Dll header



Absolutely this is one of the worst possible solutions.

KEEP YOUR DLLs OUT OF THE SYSTEM32 FOLDER!!!!!

Not only does this create problems where you might overwrite a DLL of the same name, or
have a DLL of the same name overwrite yours, but in many real environments the System32
folder is locked down and not only cannot be written to, but often changes are expunged as
potential security threats. I've worked in these environments. (In fact, in one
environment, if a "foreign" DLL, that is, one not on the corporate-approved list, is found
in your System32 folder, your machine is mapped out of the network for security reasons,
and only someone from security operations can authorize putting it back in, AFTER the DLL
is removed).

Any solution that involves putting your own DLLs in the System32 folder should be
automatically labelled "UNACCEPTABLE".

Putting the DLL in the System32 folder is COMPLETELY UNRELATED TO USING A HEADER FILE! THE
TWO CONCEPTS HAVE ABSOLUTELY ****NOTHING**** TO DO WITH EACH OTHER!!!

Putting the declaration in the C/C++ source module is a very "retro" step; it says "I'd
rather do it wrong than right". Header files exist for a reason, which is to keep one
single definition point in sync with the actual module. It is Very Bad Practice to simply
declare the functions as extern in the module makes maintenance extremely difficult, if
not impossible, and adds the possibility that you will have seriously malfunctioning
software. For example, it will compile and link, and work fine until the "error" path is
taken that calls a function whose actual implementation has changed, at which point the
program does something really exciting like take an access fault. Assume that any
practice that does NOT use header files should be labelled "UNACCEPTABLE".

Sloppy programming to avoid correct solutions is UNACCEPTABLE. This is just being lazy. Do
the job right. Nothing proposed here is even marginally acceptable programming practice.

This proposal is somewhere between laughable and dangerous and fundamentally point 3 makes
no sense at all!!!!

If I employed a programmer who did this more than once, said programmer would be in search
of new employment. One warning, and one warning only. Developing bad habits like this, or
even suggesting them, is irresponsible.
joe

On 19 Nov 2006 19:43:33 -0800, "vishal.g.shah@xxxxxxxxx" <vishal.g.shah@xxxxxxxxx> wrote:


there is one more solution to this you can use

extern "C" _declspec(dllimport) void fn_in_dll();
// prototype of fn to be used fm dll in your code
// fn_in_dll is the name of fn u defined in dll

and add the path of lib file to
1)project ->settings ->link ->input ->additional lib paths .
2) copy your dll into the system 32 folder of your C drive
3) now u can use the dll function in your code without requiring to add
any header file?
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Need to purge vulnerable gdiplus.dll?
    ... all of MS's MS04-028 patches applicable to the machines. ... DLL get upgraded now? ... should not just remove/replace vulnerable DLLs lest breakage occur. ... And in the System32 ...
    (NT-Bugtraq)
  • Re: Cannot open include file:problem with Dll header
    ... KEEP YOUR DLLs OUT OF THE SYSTEM32 FOLDER!!!!! ... have a DLL of the same name overwrite yours, but in many real environments the System32 ... Putting the DLL in the System32 folder is COMPLETELY UNRELATED TO USING A HEADER FILE! ... Nothing proposed here is even marginally acceptable programming practice. ...
    (microsoft.public.vc.mfc)
  • Re: Error 22272: Cannot load the DLL xpstar.dll...
    ... I would look for MSVCR71.DLL in SYSTEM32. ... I believe that if an entire DLL was missing, ... Reinstall the SQL Server tools? ...
    (comp.databases.ms-sqlserver)
  • Re: MFC DLL at Application Folder Saves Memory As Well?
    ... > do the two applications share memory and I can save memory? ... Suppose the user installs ... application A that drops the DLL into system32. ...
    (microsoft.public.vc.language)
  • Re: .Net packaging/wrapper application?
    ... the simple answer to DLL Hell for Visual Basic apps was simply to place a copy of the needed DLLs in the same directory as your executable. ... The way Windows works is to look in the executable's directory for a needed DLL BEFORE using the registry to find one EVEN IF THE REFERENCED DLL IS REGISTERED ON THE PC RUNNING THE APPLICATION THAT NEED IT. ... Perhaps I'm getting old and but what really bothers me is nobody seems to notice this--maybe the 80s was before they got into programming. ... Looks to me like Jim is looking for the .NET equivalent of compiling with static libraries to produce a single executable. ...
    (microsoft.public.dotnet.framework.aspnet)