Author Topic: CPP DLLs ?  (Read 4067 times)

rompelstilchen

  • Guest
CPP DLLs ?
« on: May 14, 2007, 12:42:08 pm »
Hi,

I create a dll with codeblocks and everything works fine
as I change the main.c to main.cpp
then something go wrong and the programm supposed to load the dll get not compiled
It says at link time that it can't find -lsample library althought it is in the same rep

is it not possible to write dlls in cpp ? only in c ?
as I change back the name to main.c, it is still not working even if i do distclean on the dll and app project

any idea ?
thx

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: CPP DLLs ?
« Reply #1 on: May 14, 2007, 06:19:47 pm »
is it not possible to write dlls in cpp ? only in c ?

It's possible to write a dll in C++. But a special wrapper is necessary to avoid name mangling issue. Do a Google search and you'll come to know how to do that.

Regards,

Biplab
Be a part of the solution, not a part of the problem.

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: CPP DLLs ?
« Reply #2 on: May 14, 2007, 07:37:55 pm »
Be sure your exported stuff is defined with
Code
extern "C" __declspec(dllexport)

Regards
raph