0

i tried to create a C++ dll with this code:

#include "stdafx.h"
#include <stdio.h>

extern "C" {
    _declspec(dllexport)void DoSomethingInC(unsigned short int ExampleParam, unsigned char AnotherExampleParam) {
        printf("You called the method DoSomethingInC, You passed in %d and %c\n\r", ExampleParam, AnotherExampleParam);
    }
}

But if i click on "local windows debugger" i get:

"The program can't be started...It is not a valid Win32-Application"

I tried to switch the target platform in the configuration settings but that didn't help.

Any ideas, what i am doing wrong?

System is Windows 10 64-Bit

binaryBigInt
  • 1,247
  • 1
  • 13
  • 27
  • 2
    You can not execute a dll project. You need a main executable that uses the dll. Create a second project for that. – drescherjm Jan 27 '16 at 17:48
  • But what happens if i want to use the dll in my C# project like explained here? http://stackoverflow.com/questions/11425202/is-it-possible-to-call-a-c-function-from-c-net – binaryBigInt Jan 27 '16 at 17:50
  • 2
    Then create a C# example program to test the dll. I am a native c++ developer who does not use .net so I can not help you with that. – drescherjm Jan 27 '16 at 18:05
  • If i try to import the c++ .dll i get: "This is not a valid assembly or com-component"? – binaryBigInt Jan 27 '16 at 18:50
  • 2
    That's an entirely different question. I would delete this one and post a new one, and make sure you include a C# or .Net tag so you get readers who know about the managed code requirements. – Adrian McCarthy Jan 27 '16 at 19:43

0 Answers0