-
Need help with a dll!
I am currently building a small dll that makes your pc "beep". I am using it with another language called gml. My gml syntax is correct.
There are no errors in the code but my pc refuses to "beep".
Here is my c++ code:
dllmain.cpp:
Code:
#include "dll.h"
#include <string>
#include <cstdlib>
#include <windows.h>
export double bp(int pitch,int length) {
return Beep(pitch,length);
}
dll.h:
Code:
#ifndef _DLL_H_
#define _DLL_H_
#define export extern "C" __declspec (dllexport)
#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */
class DLLIMPORT DllClass
{
public:
DllClass();
virtual ~DllClass(void);
private:
};
#endif /* _DLL_H_ */
Any help would be appreciated.
-
Have you tried calling Beep directly with the same arguments (hz and length) and you hear something. Check the return value for errors (Beep returns a bool, not double).
-
ok...
could you give me a code example? I'm a beginner when it comes to dlls.
-
-
The point of the dll is that the user defines what values Beep takes.
-
You can take baby steps until you attain full functionality.
Right now, it is important for you to make sure your function is even being called, and that it returns no errors.