What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Request] Loading DLL

[Request] Loading DLL
Author: Message:
S4KurA_^
New Member
*


Posts: 3
35 / Male / –
Joined: May 2007
O.P. [Request] Loading DLL
Hi erveryone,

I'm a new member of this great forum and hope to find nice people :)
Hmm... I can say more about me first, if you would like.
My name is Jérôme, is 20 years old, born and live in Strasbourg (North-East France) and got used to create C/C++ statements for plugin for Messenger Plus! older versions.


I would like to extend the limited functions provided by JScript in adding an external library (.dll) to provide new powerful features.
But when calling Interop.Call(), the debugging window tell me that an unknown error has occured. :(

Here is a part of the C/C++ code in the DLL file :

test.h header file

code:
#ifndef _TEST_H_
#define _TEST_H_

#ifndef _UNICODE
#define _UNICODE
#endif

#define DLLEXPORT __declspec(dllexport)

extern "C++" {

// API test
int __stdcall DLLEXPORT CreateTest(TCHAR* szMessage);


} // end extern C++

#endif



Now, the C++ source file

code:
#include <windows.h>
#include "test.h"


extern "C++" {


// API test
int __stdcall DLLEXPORT CreateTest(TCHAR* szMessage) {


    MessageBox(NULL, ":)", ":)", 0);
    MessageBox(NULL, szMessage, TEXT(";)"), MB_ICONHAND | MB_OK);
    return 1;
}


} // end extern C++



And a part of my script file :

code:
Interop.Call("xmsn32.dll", "CreateTest", Message);
Debug.Trace("Test created - " + Message);
FreeDll("xmsn32.dll");



I've a copy/paste the dll file into Windows system directory and know that the script has found and load it.
But an unkown error occured when calling Interop.Call()...

Has someone an idea ?
I thank you all in advance for your help

Cheers,
S4KurA_^

PS : Sorry for by english, but I try to do my best :P

This post was edited on 05-15-2007 at 08:01 PM by S4KurA_^.
05-15-2007 08:00 PM
Profile PM Find Quote Report
S4KurA_^
New Member
*


Posts: 3
35 / Male / –
Joined: May 2007
O.P. RE: [Request] Loading DLL
Hmmm have found the solution : the function is exported by Dev-C++ with an other name that specified... then Interop.Call() can't find the function within the DLL.

:)
05-15-2007 08:25 PM
Profile PM Find Quote Report
Patchou
Messenger Plus! Creator
*****

Avatar

Posts: 8607
Reputation: 201
41 / Male / Flag
Joined: Apr 2002
RE: [Request] Loading DLL
that's because of the "extern C++" directive. Replace that by "extern C" when declaring the function and its name should not be decorated.
[Image: signature2.gif]
05-15-2007 10:55 PM
Profile PM Web Find Quote Report
S4KurA_^
New Member
*


Posts: 3
35 / Male / –
Joined: May 2007
O.P. RE: [Request] Loading DLL

Hi Patchou,

I already know that yesterday :)
Problem solved.

Thanks for your answer


Cheers,
S4KurA_^
05-16-2007 07:41 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On