J
Jason
Hello, I've got an example from the mingw website of creating a dll. It is
3 files: a header, .c file and another file containing main. I want to use
the dll in VB and it works for tstfunc, but I am not able to use tststr as
it wont export.
header file:
#ifdef BUILD_DLL
// the dll exports
#define EXPORT __declspec(dllexport)
#else
// the exe imports
#define EXPORT __declspec(dllimport)
#endif
// function to be imported/exported
EXPORT int tstfunc (void);
EXPORT long tststr (void); //I want to use function too
..c file
#include <stdio.h>
#include "dllfct.h"
EXPORT int tstfunc (void)
{
return 200;
}
EXPORT long tststr (void) { //am returning a long due to wanting to use
the pointer in VB because
//experimenting with what
values I can return and use from the dll
char p[10];
p = (char *) "hello\0";
return (long *) p;
}
If I do the below it gives me an error at compile time due to an undefined
reference to _imp__tststr, the name of the second function I wish to export.
#include "dllfct.h"
int main ()
{
tstfunc ();
tststr();
return (0);
}
I guess I need to change this to export the second function, but how? What
does it mean?
#ifdef BUILD_DLL
// the dll exports
#define EXPORT __declspec(dllexport)
#else
// the exe imports
#define EXPORT __declspec(dllimport)
#endif
Thanks for any help.
3 files: a header, .c file and another file containing main. I want to use
the dll in VB and it works for tstfunc, but I am not able to use tststr as
it wont export.
header file:
#ifdef BUILD_DLL
// the dll exports
#define EXPORT __declspec(dllexport)
#else
// the exe imports
#define EXPORT __declspec(dllimport)
#endif
// function to be imported/exported
EXPORT int tstfunc (void);
EXPORT long tststr (void); //I want to use function too
..c file
#include <stdio.h>
#include "dllfct.h"
EXPORT int tstfunc (void)
{
return 200;
}
EXPORT long tststr (void) { //am returning a long due to wanting to use
the pointer in VB because
//experimenting with what
values I can return and use from the dll
char p[10];
p = (char *) "hello\0";
return (long *) p;
}
If I do the below it gives me an error at compile time due to an undefined
reference to _imp__tststr, the name of the second function I wish to export.
#include "dllfct.h"
int main ()
{
tstfunc ();
tststr();
return (0);
}
I guess I need to change this to export the second function, but how? What
does it mean?
#ifdef BUILD_DLL
// the dll exports
#define EXPORT __declspec(dllexport)
#else
// the exe imports
#define EXPORT __declspec(dllimport)
#endif
Thanks for any help.