Shared libraries/DLLs

Bjoern nanali at nospam-wanadoo.fr
Fri Feb 1 01:22:15 PST 2008


Hm,
1-
__declspec(dllimport) int __stdcall foo();
becomes :
export extern(Windows) int foo();

so, I would give extern(Windows) instead of extern(C) a try to avoid 
name mangeling problems.

2-
Just guessing :
You have module library "DLLMain()" and loader "main()" try to place 
main() in a seperate file.

3-
UNKNOWN WROTE :
"I want to dynamically link, and also call functions from the code that 
is dynamically linking."

I can imagine that using callbacks is an interesting option to establish 
plugings, like :

//THE DLL
// define the callback function.
alias extern(Windows) void function(char* token, size_t siz = 0, bool 
error =false) DisplayCallBack;


export extern(Windows)
void ExecuteProcess(DisplayCallBack cb, char* _dir, char* _command, 
char* _args)
{
   //do someting and call CallBack function defined in Application
   cb(tok, tok_size)
}

HTH Bjoern


More information about the Digitalmars-d-learn mailing list