What's new

C++ help (again) :)

Doomulation

?????????????????????????
I have another problem this time of which i can't figure out for all of my life. As you see, I'm doing a dll. Now, I try to compile it and get this errors:

Linking...
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in Doom Music Player.obj
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in Doom Music Player.obj; second definition ignored
Creating library Debug/Doom Music Player.lib and object Debug/Doom Music Player.exp
Debug/Doom Music Player.dll : fatal error LNK1169: one or more multiply defined symbols found

To that, these are the libraries I'm using to link: dxguid.lib Strmiids.lib winmm.lib.
Now, I only have one function named DllMain: BOOL WINAPI DllMain(HANDLE hinstDLL, DWORD dwReason, LPVOID lpvReserved);

Anyway, I still get a compile error saying there's two function of the same? I did a search through all files and found no more but the declaration and the implemtion.
I checked all external files (ie, included files), and there was no mention of this DllMain.

I made this Dll project with MFC AppWizard (dll) with Regular dll using shared MFC dlls.
And that's probably all I can say. Can anyone tell me what's wrong?
 
OP
Doomulation

Doomulation

?????????????????????????
Also, hacktarux "thinks" that you have to use another function when using MFC dlls for the dll's main. I don't know, though, maybe you can tell me, however.
 
OP
Doomulation

Doomulation

?????????????????????????
So, is there a way to dynamically link it to the mfc library somewhere in the settings? Without choosing it when first creating a new project. I couldn't find that option... :blush:
 

aprentice

Moderator
whoa, your crazy =p mfc might be great for making fast gui's but your working on a dll. just drop mfc and use standard win32, since you wont be needing mfc for what your doing.
 
OP
Doomulation

Doomulation

?????????????????????????
Hehe aprentice, I just did. It's in my unlreleased version of it.
However, I just encountered that it doesn't export the functions right. Using stdcall function convertion and using a .def-file exporting them, but still it doesn't export them right...

it's typical DMUSIC_API int Init();
I think you know what DMUSIC_API is since you've probably made regular dlls yourself :D

EDIT: It doesn't seem to export functions right even directly after a new project :cry: I can bet it worked fine before! It doesn't find the exported functions at all!

Some more facts:

I've tried a test function such as these:

int test(int test)
DMUSIC_API int test(int test)
extern "C" DMUSIC_API int test(int test)
extern "C" int test(int test)
{
return test;
}

#define DMUSIC_API __declspec(dllexport)

The function body is the same for all; yet none works. It's just a simple test function, but it cannot even find that. Finally, the incomplete .def file:

LIBRARY "DMusic"
DESCRIPTION 'Doom Music Player DirectMusic Handler'

EXPORTS
; Explicit exports can go here
test
 
Last edited:

Cyberman

Moderator
Moderator
here is what I'm using with BCB this works with PJ64 by the way just dandy.

Code:
#define EXPORT						extern "C" __declspec(dllexport)
#define CALL						_cdecl
EXPORT void CALL CloseDLL (void);

//---------------------------------------------------------------------------
void CALL CloseDLL(void)
{
   // Chain to Input Plugin's Clossing
}
 
OP
Doomulation

Doomulation

?????????????????????????
Funny someone would reply to it after such a long time...I've found the source :getlost: it's a vb bug...
I declare the dll declarations with a direct path (eg, "C:\DMusic.dll" or "C:\XXXXX\XXX\etc\DMusic.dll") it works; but when i omit the path, it doesn't. It works fine compiled, though.

Once again,
/me slaps Micro$oft for making VB so buggy.
 

Top