willc0de4food
New member
Hey, i have a problem where i can write a dll in MSVC++ and use it in VB .NET but when i try to write one in Dev-C++, it fails and pretends i dont have a [dllname].def file so i was wondering if anyone could tell me what i'm doing wrong or how to fix this problem. the DLL's name comes out as circlearea_devcpp.dll. here's my VB Code:
here's my C++ Code:
and then Dev-C++ generates a .def file and i've tried writing it myself which doesn't work either
here's theirs, filename - libcirclearea_devcpp.def:
and mine, filename - circlearea_devcpp.def:
any thoughts? thanks
VB.NET:
Private Declare Function ReturnVersion Lib "C:\Documents and Settings\Tim Hansen\My Documents\Visual Studio Projects\circlearea_devcpp.dll" () As Long
Private Declare Function circlearea Lib "C:\Documents and Settings\Tim Hansen\My Documents\Visual Studio Projects\circlearea_devcpp.dll" (ByVal area As Double) As Double
Private Sub About_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles About.Click
' Report Version Number
Call MsgBox(ReturnVersion())
End Sub
Private Sub Bye_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bye.Click
Application.Exit()
End Sub
Private Sub Calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calculate.Click
Dim area, radius As Double
radius = InputBox.Text
' call to dll for area calculation
area = circlearea(radius)
OutputBox.Text = Str$(area)
End Sub
Private Sub Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear.Click
InputBox.ResetText()
OutputBox.ResetText()
End Sub
VB.NET:
#include "stdafx.h"
#include <windows.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
int ReturnVersion(void)
{
int version = 1;
return version;
}
double circlearea(double radius)
{
double area;
area = 3.1415926535 * (radius * radius);
return area;
}
here's theirs, filename - libcirclearea_devcpp.def:
VB.NET:
; dlltool --base-file C:\DOCUME~1\TIMHAN~1\LOCALS~1\Temp/cca03420.base
--output-exp circlearea_devcpp.exp --dllname circlearea_devcpp.dll --output-def
libcirclearea_devcpp.def --no-export-all-symbols --add-stdcall-alias
--exclude-symbol=DllMainCRTStartup@12
--def C:\DOCUME~1\TIMHAN~1\LOCALS~1\Temp/cca03420.def --output-lib
libcirclearea_devcpp.a
EXPORTS
VB.NET:
EXPORTS
ReturnVersion
circlearea