Problem declaring a dll function

Previous topic - Next topic

jestermon

I've read posts similar to my problem, but seem to be missing something somewhere.
Perhaps a little help could shed some light for me

The code
Quote//---------------------------------------------------------
//DATABASE DLL FUNCTION EXPORTS
//---------------------------------------------------------
//__declspec(dllexport) void DBdebugOn(void);
//__declspec(dllexport) void DBdebugOff(void);
//__declspec(dllexport) void DBgetRecordcount(char *param);
//__declspec(dllexport) void DBgetRecord(char *param);
//__declspec(dllexport) void DBsetDatabase(char *param);
//__declspec(dllexport) void DBdoSql(char *param);
//---------------------------------------------------------

INLINE
   DECLARE_C (DBsetDatabase, "glbsqlite.dll", (char*), void);
ENDINLINE


FUNCTION SetDBName: dbName$
   INLINE
      DBsetDatabase(dbName_Str.c_str());
   ENDINLINE
ENDFUNCTION

The error message
Quote
In function `DGInt __GLBASIC__::SetDBName(__GLBASIC__::DGStr)':
127: error: `DBsetDatabase' was not declared in this scope

jestermon

I solved my own problem after looking at the simple code like a moron, for a long time.
I had declared the dll outside of the function - so it was obviously out of scope.
I then picked up that the parameter was also declared wrongly, a pointer to a constant ... fixed that too.

So I am on track again.. But thanks for reading.

fuzzy70

I have yet to use DLL's in GLBasic although there are a couple I could make use of for game editors or image processing & such. Reading your post will help me avoid that error should it arise.

Thanks :)

Lee

Sent from my GT-I5700 using Tapatalk 2

"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

jestermon

I spent a lot of time going through all references to "dll" on the forum, and found an amazing wrapper that provides a great example and coding style for dll's - Ruidesco's SunVox project. This amazing post should be stickied in the dll section as a great example of how it really should be done. It's really worth looking at.
http://www.glbasic.com/forum/index.php?topic=6910.msg56044#msg56044

fuzzy70

Quote from: jestermon on 2012-Nov-12
I spent a lot of time going through all references to "dll" on the forum, and found an amazing wrapper that provides a great example and coding style for dll's - Ruidesco's SunVox project. This amazing post should be stickied in the dll section as a great example of how it really should be done. It's really worth looking at.
http://www.glbasic.com/forum/index.php?topic=6910.msg56044#msg56044

Thank you very much jestermon for that ^-^. Have read through the post & downloaded the example as well as the sunvox files (both DLL & the program) on my phone to play with later when I'm home, otherwise would probably forget lol.

I have to admit that the brief searches I done on the forum did confuse me a bit, although that's not hard these days.

Once again thanks

Lee

Sent from my GT-I5700 using Tapatalk 2

"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)