DLL works with C++, but linker error with C
-
Hi - I read about InpOut32.dll (dll letting you access I/O ports in Nt / 2000 / XP) on some CodeProject article. The link for the DLL, with source code, is http://www.logix4u.net/inpout32.htm. I downloaded InpOut32 and copied the relevant lines from their sample CPP application to my "C" application, but I got linker errors as shown below:
TestProg.obj : error LNK2001: unresolved external symbol _Inp32@4 TestProg.obj : error LNK2001: unresolved external symbol _Out32@8 Debug/TestProg.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe.
After hours of trying to find differences between my program and the sample program, someone suggested that "C" files and "CPP" files are handled differently. I changed the name of my main program file from TestProg.c to TestProg.cpp, and the project now compiles and runs fine. I made no other changes to the project (same libraries linked, etc.) Unfortunately, the change from C to CPP compilation affects other parts of the program, so I would like to change the main program back to "C". What are the differences between how Visual Studio 6 handles "C" files compared to how it handles "CPP" files? How do I get this DLL to work with my C application? -
Hi - I read about InpOut32.dll (dll letting you access I/O ports in Nt / 2000 / XP) on some CodeProject article. The link for the DLL, with source code, is http://www.logix4u.net/inpout32.htm. I downloaded InpOut32 and copied the relevant lines from their sample CPP application to my "C" application, but I got linker errors as shown below:
TestProg.obj : error LNK2001: unresolved external symbol _Inp32@4 TestProg.obj : error LNK2001: unresolved external symbol _Out32@8 Debug/TestProg.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe.
After hours of trying to find differences between my program and the sample program, someone suggested that "C" files and "CPP" files are handled differently. I changed the name of my main program file from TestProg.c to TestProg.cpp, and the project now compiles and runs fine. I made no other changes to the project (same libraries linked, etc.) Unfortunately, the change from C to CPP compilation affects other parts of the program, so I would like to change the main program back to "C". What are the differences between how Visual Studio 6 handles "C" files compared to how it handles "CPP" files? How do I get this DLL to work with my C application?OK, my next rule is "think before you post". At least I found the answer myself before anyone flamed me. I had a look at some Borland C++ samples which came with the InpOut32 DLL, and used the "traditional" DLL techniques used there - LoadLibrary, GetProcAddress, etc. My code now works fine as a C file.