Thread: visual c++ dll error, how you fix?

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    6

    visual c++ dll error, how you fix?

    I just need some help figuring out how to fix this. the dll is inpout32.dll and it has a corresponding lib file. this is a windows forms application (io.cpp) in its infancy.

    Here is the error:
    Code:
    ------ Build started: Project: io, Configuration: Debug Win32 ------
    Compiling...
    io.cpp
    k:\program files\io\io\io\Form1.h(320) : warning C4441: calling convention of '__stdcall ' ignored; '__clrcall ' used instead
    k:\program files\io\io\io\Form1.h(321) : warning C4441: calling convention of '__stdcall ' ignored; '__clrcall ' used instead
    Linking...
    io.obj : error LNK2020: unresolved token (06000004) io.Form1::Inp32
    io.obj : error LNK2020: unresolved token (06000005) io.Form1::Out32
    K:\Program files\io\io\Debug\io.exe : fatal error LNK1120: 2 unresolved externals
    Build log was saved at "file://k:\Program files\io\io\io\Debug\BuildLog.htm"
    io - 3 error(s), 2 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    and here is the code I tried to use that brought the error up:
    Code:
    	int reg;
    	reg=Inp32(378);
    
    	short _stdcall Inp32(short PortAddress);
    	void _stdcall Out32(short PortAddress, short data);

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    It appears to me you are trying to use the __stdcall calling convention in a managed ref class. The calling convention for ref classes is __clrcall.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    A better question would be why you're using the API of an obsolete OS to read your devices, when your new OS has API calls to do the same thing.

    Things like inpout32 are an historic kludge to help with the transition of really old code to a new environment. Using them in new code is just storing up problems for the future.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    6
    if there is a better way please tell me how.
    I am using inpout32 because I can find no other way to do what I am trying to do.
    I am trying to read the pin IO then set individual out pins to I or O. the idea is to control a machine from the port. The machine will read individual pins and act accordingly, thus controlling 8 separate functions independently, details aside. it will give feedback through the input pins. with xp a driver is needed to access the pins. I don't know of any free drivers that will allow this except inpout32.

    I would like to do it all through the usb port but I don't know how to do the electronics for that, nor do I know how to program for usb.

    I have built port pin IO programs for linux and dos but windows is what i need now

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    CreateFile Function (Windows)
    Creates or opens a file or I/O device. The most commonly used I/O devices are as follows: file, file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, and pipe. The function returns a handle that can be used to access the file or device for various types of I/O depending on the file or device and the flags and attributes specified.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Not quite sure how that generated a __clrcall warning. Perhaps the compiler is confused.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. writing a dll in visual studio 2008
    By xixpsychoxix in forum Windows Programming
    Replies: 4
    Last Post: 09-14-2009, 03:13 AM
  2. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Erros in Utility Header File
    By silk.odyssey in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2003, 06:17 AM
  5. odd errors from msvc std library files
    By blight2c in forum C++ Programming
    Replies: 6
    Last Post: 04-30-2002, 12:06 AM

Tags for this Thread