Suppress name mangling for extern "stdcall"?

I'm trying to call functions in an old .dll. As far as I can tell, it uses the stdcall convention, however, the names are not mangled. E.g. the name is RwOpen and not _RwOpen@8. Calling with libloading under that assumption certainly seems to work, at least.

How do I use extern "stdcall" with this, when it seems to insist on looking for, and failing to link to, _RwOpen@8?

I think you're looking for this:

extern "stdcall" {
  #[link_name="_RwOpen@8"]
  fn RwOpen();
}

If this is not what you want, can you please post some more information about what you're doing now and what exactly isn't working?

I think link_name is what I was looking for, although as "RwOpen" instead of "_RwOpen@8"

However, I was talking to WindowsBunnyServ on IRC, who said that it was a bad .lib that was causing the issues. Specifically, for stdcall libraries, the .lib file contains a mangled name like _RwOpen@8, while the .dll does not. I did not have the vendor's .lib file, so I attempted to produce my own with lib.exe, and WindowsBunnyServ told me that lib cannot be used to make .lib files for stdcall functions.

I'm happy to just use libloading for this project, which is working fine.