0

so here's my issue. I have a DLL that is referenced by an application (both of which I'm writing). The DLL should declare a method, called AppMain, and the application should define this method. Before I started using DLLs I was using a LIB file and the extern keyword. My code used to look like this:

The referenced assembly

extern bool AppMain(void* input);

The application referencing the assembly

#pragma comment( lib, "TheReferencedAssembly.lib" )

bool AppMain( void* input )
{
    // Awesome stuff
}

Now that I'm using a DLL, I've droppped the #pragma comment part and just referenced the assembly and included a header that contains the declaration, but I keep getting the old unresolved reference error.

Any help here would be greatly appreciated. Thanks!

Will Custode
  • 4,576
  • 3
  • 26
  • 51
  • It's actually possible to do what you're asking but it can be messy. You need to use `dllimport` and `dllexport` just like you normally would even though the function resides in an .exe. An export library will be generated (yes for the .exe) which your .dll can link to. You just have to deal with the dependency of the export library - you can use a dummy project to generate one or cobble one up manually. – Captain Obvlious Mar 23 '14 at 17:14
  • @CaptainObvlious: I'm familiar with what you're talking about but could you maybe explain it a bit in an answer? I've resorted to using a static LIB for now until I can find out how to actually do this. – Will Custode Mar 24 '14 at 14:37

0 Answers0