0

I have the same problem exposed here. I'm using Visual C++ Express 2010.

I tried declaring extern "C", and changing the options Project + Properties, Linker, Debugging, Generate Debug Info = No. My function names are mangled on every compilation.

After reading the answer of jjones I changed the calling convention from StdCall to Cdecl, and then my function names are correct in the compiled dll. But I need the StdCall because I'm using this dll from VB6 (Vb6 protests when using other calling convention). So, everytime I compile with StdCall calling convention, my function names get mangled again.

How can I avoid my function names from being mangled with StdCall calling convention? or Is there a way to call a function in a Dll with cdecl calling convention from VB6?

Community
  • 1
  • 1
Broken_Window
  • 2,037
  • 3
  • 21
  • 47

1 Answers1

0

After reading and reading I found out that (maybe) there's no way to avoid name mangling with StdCall calling convention.

I wanted to call my functions from VB6, so here's a workaround that actually works: Declaring the functions with alias:

Declare Function prettyname Lib "mydll.dll" Alias "_prettyname@16" () As Integer

Of course, it is better to use extern "C", so the names don't get horribly mangled.

Broken_Window
  • 2,037
  • 3
  • 21
  • 47