Author Topic: Forwarding functions in dll  (Read 4167 times)

cbhte

  • Guest
Forwarding functions in dll
« on: January 15, 2011, 03:02:20 am »
Hey all,

I got a problem with CB, because I don't now how CB handles it:

I have a function FuncA defined in MyOldDll.h, which I included in a new dll-project.
Now I want to export this FuncA out of the MyOldDll.h. First I tried:
Code: [Select]
#include <MyOldDll.h>

void __declspec(dllexport) FuncA();

But when I compile it, there is no exported function (controlled with DependencyWalker). I noticed that I have to implement FuncA, but it is already implemented in the old lib, which I linked to my new dll!

In MSVC I could use the .def-file and write EXPORT FuncA = MyOldDll.FuncA
But how can I handle it in CB? It is important that I can reimplement some functions. e.g.: FuncB (which was already there in MyOldDll), but in this dll FuncB does something new and then (to keep it downward compatible) call FuncB:
Code: [Select]
#include <MyOldDll.h>

void __declspec(dllexport) FuncA();    // it should call FuncA in MyOldDll
void __declspec(dllexport) FuncB();    // new implementation...

void __declspec(dllexport) FuncB()
{
  DoSomethingNewHere();
  FuncB();  // call FuncB in MyOldDll
}

I really hope you can help me solving this problem, I have to do it this way and not implementing all functions again :-(
thank you
 cbhte

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Forwarding functions in dll
« Reply #1 on: January 15, 2011, 09:12:31 am »
This question is not releted to C::B.

C::B is "just" an IDE, that works with many compilers and not a compiler.

Please ask this question in a forum related to the comiler you use, or search the internet with your favourite search engine.