Thread: [Dev-C++] Problem using DLL (compiled in DEV-C++) in Visual Basic
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Elektro <el...@wo...> - 2001-08-21 16:18:34
|
Somebody has compiled a DLL in DEV-C++ and used in VB later ?
I have compiled a DLL in DEV-C++ but it don=B4t work in VB, I have the=
message "DLL convention call type is incorrect"
#include <windows.h>
# define DLLIMPORT __declspec (dllexport)
BOOL WINAPI DllMain( HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved){
return TRUE;
}
DLLIMPORT int suma(int a,int b){
return a+b;
}
DLLIMPORT int resta(){
return 7*8;
}
DLLIMPORT int multiplica(int a,int b){
return a*b;
}
DLLIMPORT int nada(){
return a*45;
}
|
|
From: Aaron W. <Aar...@My...> - 2001-08-22 02:28:48
|
First of all, sorry for the long post, but it is all important.
Bad DLL Calling Convention, means that it doesnt accept the values passed to
it.
For ex, if you had a DLL called MyDLL.dll, and a function called MyRet, then
use the following.
Private Declare Function MyRet lib "MyDLL.dll"() as Integer
**Private Declare Function MyRet lib "MyDLL.dll"(ByVal A as Integer) as
Integer**
This second one, will cause the error.
I have not yet figured out why Dev-c++ does this, I have managed to stop it
mangling the export names, however.
just add this to a CPP:
#include <windows.h>
#define DLLEXPORT extern "C" __declspec (dllexport)
int WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
{
return TRUE;
}
DLLEXPORT int Ret(int val1){
return 1;
}
This will export the Ret function as Ret and not Ret__FFV@12 or similar.
I dont think when compiling, that DEV-C++ or MingW compiler, recognises it
as a function I say this because if you add this to the above CPP
DLLEXPORT int Ret(int val1){
**MessageBox(0,"Hello","Hello VB",1);**
return 1;
}
and call this: Private Declare Sub MyRet lib "MyDLL.dll"()
and on Form_Load call MyRet it will display the msgbox not needing the
arguments passed to it.
Wilksey
----- Original Message -----
From: "Elektro" <el...@wo...>
To: <dev...@li...>
Sent: Tuesday, August 21, 2001 17:14
Subject: [Dev-C++] Problem using DLL (compiled in DEV-C++) in Visual Basic
Somebody has compiled a DLL in DEV-C++ and used in VB later ?
I have compiled a DLL in DEV-C++ but it don´t work in VB, I have the message
"DLL convention call type is incorrect"
#include <windows.h>
# define DLLIMPORT __declspec (dllexport)
BOOL WINAPI DllMain( HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved){
return TRUE;
}
DLLIMPORT int suma(int a,int b){
return a+b;
}
DLLIMPORT int resta(){
return 7*8;
}
DLLIMPORT int multiplica(int a,int b){
return a*b;
}
DLLIMPORT int nada(){
return a*45;
}
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: softnasolutions-ltd.fsbusiness.co.uk <so...@so...> - 2001-08-22 18:35:47
|
Hi Guys, Sorry to bother you with my non programming question but i hope you'll help. I'm designing business stationary for a friend and i need to design and print envelopes with his company logo and other graphics on it. Can anyone tell me a software i can use. I will using an HPdesk jet 980cxi printer. thnx napoleon. |
|
From: Ramana K. <ra...@my...> - 2001-08-23 07:23:12
|
Microsoft Publisher will do the job well It comes with Office Suite Proffesional and above and also as standalone. -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of softnasolutions-ltd.fsbusiness.co.uk Sent: Thursday, 23 August 2001 4:35 AM To: dev...@li... Subject: [Dev-C++] DTP software Hi Guys, Sorry to bother you with my non programming question but i hope you'll help. I'm designing business stationary for a friend and i need to design and print envelopes with his company logo and other graphics on it. Can anyone tell me a software i can use. I will using an HPdesk jet 980cxi printer. thnx napoleon. _______________________________________________ Dev-cpp-users mailing list Dev...@li... http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: jansb000 <jan...@wx...> - 2001-08-23 19:04:51
|
I used to work with Corel Draw 5. It can do the job. ----- Original Message ----- From: "Ramana Kumar" <ra...@my...> To: <dev...@li...> Sent: Thursday, August 23, 2001 9:25 AM Subject: RE: [Dev-C++] DTP software > Microsoft Publisher will do the job well > It comes with Office Suite Proffesional and above and also as standalone. > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...]On Behalf Of > softnasolutions-ltd.fsbusiness.co.uk > Sent: Thursday, 23 August 2001 4:35 AM > To: dev...@li... > Subject: [Dev-C++] DTP software > > Hi Guys, > Sorry to bother you with my non programming question but i hope you'll help. > I'm designing business stationary for a friend and i need to design and > print envelopes with his company logo and other graphics on it. Can anyone > tell me a software i can use. I will using an HPdesk jet 980cxi printer. > > thnx > > napoleon. > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Elektro <el...@wo...> - 2001-08-30 17:37:25
|
Thanks, but I have this code in VB and it fails:
Private Declare Function multiplica Lib "d:\elektro\proyect.dll" (byval a=
As integer,byval b As integer) As Integer
Private Sub Form_Activate()
MsgBox multiplica(2, 2)
End Sub
And this code for multiplica function in DEV-C++
DLLIMPORT int multiplica(int a,int b){
return a*b;
}
Where is the error ?
My DLL need the Win32 console subsistem and others DLL=B4s need the Win32=
GUI subsistem but I have selected in DEV-C++ Compile for Win32 (no=
console) , Create a DLL and Do not create a console in project and=
compiler options.
can it be the problem ?
*********** REPLY SEPARATOR ***********
On 22/08/01 at 3:31 Aaron Wilkes wrote:
>First of all, sorry for the long post, but it is all important.
>
>Bad DLL Calling Convention, means that it doesnt accept the values passed
>to
>it.
>For ex, if you had a DLL called MyDLL.dll, and a function called MyRet,
>then
>use the following.
>Private Declare Function MyRet lib "MyDLL.dll"() as Integer
>
>**Private Declare Function MyRet lib "MyDLL.dll"(ByVal A as Integer) as
>Integer**
>This second one, will cause the error.
>I have not yet figured out why Dev-c++ does this, I have managed to stop=
it
>mangling the export names, however.
>
>just add this to a CPP:
>
>#include <windows.h>
> #define DLLEXPORT extern "C" __declspec (dllexport)
>int WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
>{
>return TRUE;
>}
>DLLEXPORT int Ret(int val1){
>return 1;
>}
>
>This will export the Ret function as Ret and not Ret__FFV@12 or similar.
>
>I dont think when compiling, that DEV-C++ or MingW compiler, recognises it
>as a function I say this because if you add this to the above CPP
>DLLEXPORT int Ret(int val1){
>**MessageBox(0,"Hello","Hello VB",1);**
>return 1;
>}
>
>and call this: Private Declare Sub MyRet lib "MyDLL.dll"()
>
>and on Form_Load call MyRet it will display the msgbox not needing the
>arguments passed to it.
>
>Wilksey
>----- Original Message -----
>From: "Elektro" <el...@wo...>
>To: <dev...@li...>
>Sent: Tuesday, August 21, 2001 17:14
>Subject: [Dev-C++] Problem using DLL (compiled in DEV-C++) in Visual Basic
>
>
>Somebody has compiled a DLL in DEV-C++ and used in VB later ?
>
>I have compiled a DLL in DEV-C++ but it don=B4t work in VB, I have the
>message
>"DLL convention call type is incorrect"
>
>#include <windows.h>
>
># define DLLIMPORT __declspec (dllexport)
>
>BOOL WINAPI DllMain( HINSTANCE hinstDLL,
> DWORD fdwReason,
> LPVOID lpvReserved){
> return TRUE;
>}
>
>DLLIMPORT int suma(int a,int b){
> return a+b;
>}
>
>DLLIMPORT int resta(){
> return 7*8;
>}
>
>DLLIMPORT int multiplica(int a,int b){
> return a*b;
>}
>
>DLLIMPORT int nada(){
> return a*45;
>}
|
|
From: Aaron W. <Aar...@My...> - 2001-08-30 23:52:10
|
The error is that the DLL which Dev makes, does not see the functions as
being a function, you cant have things passed to it.
You can call it from DEV, but not VB.
I have tried several things, the only way i could do it is by making one in
MSVC++, i have example code for that.
But the examples come out exactly the same as when trying to make your own.
Try downloading the Borland C++ 5.5 Compiler, which is free, and try
compiling DLL's in that, i dont know if it does or not.
Aaron
----- Original Message -----
From: "Elektro" <el...@wo...>
To: <dev...@li...>
Sent: Thursday, August 30, 2001 18:32
Subject: Re: [Dev-C++] Problem using DLL (compiled in DEV-C++) in Visual
Basic
Thanks, but I have this code in VB and it fails:
Private Declare Function multiplica Lib "d:\elektro\proyect.dll" (byval a As
integer,byval b As integer) As Integer
Private Sub Form_Activate()
MsgBox multiplica(2, 2)
End Sub
And this code for multiplica function in DEV-C++
DLLIMPORT int multiplica(int a,int b){
return a*b;
}
Where is the error ?
My DLL need the Win32 console subsistem and others DLL´s need the Win32 GUI
subsistem but I have selected in DEV-C++ Compile for Win32 (no console) ,
Create a DLL and Do not create a console in project and compiler options.
can it be the problem ?
*********** REPLY SEPARATOR ***********
On 22/08/01 at 3:31 Aaron Wilkes wrote:
>First of all, sorry for the long post, but it is all important.
>
>Bad DLL Calling Convention, means that it doesnt accept the values passed
>to
>it.
>For ex, if you had a DLL called MyDLL.dll, and a function called MyRet,
>then
>use the following.
>Private Declare Function MyRet lib "MyDLL.dll"() as Integer
>
>**Private Declare Function MyRet lib "MyDLL.dll"(ByVal A as Integer) as
>Integer**
>This second one, will cause the error.
>I have not yet figured out why Dev-c++ does this, I have managed to stop it
>mangling the export names, however.
>
>just add this to a CPP:
>
>#include <windows.h>
> #define DLLEXPORT extern "C" __declspec (dllexport)
>int WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
>{
>return TRUE;
>}
>DLLEXPORT int Ret(int val1){
>return 1;
>}
>
>This will export the Ret function as Ret and not Ret__FFV@12 or similar.
>
>I dont think when compiling, that DEV-C++ or MingW compiler, recognises it
>as a function I say this because if you add this to the above CPP
>DLLEXPORT int Ret(int val1){
>**MessageBox(0,"Hello","Hello VB",1);**
>return 1;
>}
>
>and call this: Private Declare Sub MyRet lib "MyDLL.dll"()
>
>and on Form_Load call MyRet it will display the msgbox not needing the
>arguments passed to it.
>
>Wilksey
>----- Original Message -----
>From: "Elektro" <el...@wo...>
>To: <dev...@li...>
>Sent: Tuesday, August 21, 2001 17:14
>Subject: [Dev-C++] Problem using DLL (compiled in DEV-C++) in Visual Basic
>
>
>Somebody has compiled a DLL in DEV-C++ and used in VB later ?
>
>I have compiled a DLL in DEV-C++ but it don´t work in VB, I have the
>message
>"DLL convention call type is incorrect"
>
>#include <windows.h>
>
># define DLLIMPORT __declspec (dllexport)
>
>BOOL WINAPI DllMain( HINSTANCE hinstDLL,
> DWORD fdwReason,
> LPVOID lpvReserved){
> return TRUE;
>}
>
>DLLIMPORT int suma(int a,int b){
> return a+b;
>}
>
>DLLIMPORT int resta(){
> return 7*8;
>}
>
>DLLIMPORT int multiplica(int a,int b){
> return a*b;
>}
>
>DLLIMPORT int nada(){
> return a*45;
>}
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|