• Welcome to Valhalla Legends Archive.
 

stupid question about dlls....

Started by brew, June 01, 2007, 07:03 PM

Previous topic - Next topic

brew

im trying to make just ANY dll right now that works

//in the dlltest.h file
#ifndef DLLTEST_H_
#define DLLTEST_H_
__declspec(dllexport) int asdfness(int asdf);
#endif

//in the dlltest.cpp file
#include "dlltest.h"

__declspec(dllexport)
int asdfness(int asdf) {
int lolz = 0;
lolz = asdf + 3000;
return lolz;
}

and it keeps saying entry point not found. and i looked at about 100 different sites and they all said the same exact thing. soooo... anyone see anything wrong with this code? i'm a big noobie so i bet it's a syntax error or something
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

l2k-Shadow

are you calling it from VB? if so do this:



extern "C" {

__declspec(dllexport)
int asdfness(int asdf) {
int lolz = 0;
lolz = asdf + 3000;
return lolz;
}
}


extern C will compile it as a C function without adding extra crap to your export name, also you don't need the header file.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

brew

just tried that. it now gives me an error "bad dll calling convention"... grr
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

l2k-Shadow

Quote from: brew on June 01, 2007, 08:23 PM
just tried that. it now gives me an error "bad dll calling convention"... grr

yeah VB sucks, it works if you compile the prog though.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

brew

#4
just tried. it worked (thank god) but it gave me the unexpected result. "1697" when it was supposed to be "3005"
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

l2k-Shadow

mind uploading your calling program, and your dll?
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

brew

sure. http://zenixstudios.com/f.php?f=xjskjkpo


Private Declare Function asdfness Lib "dlltest" (asdf As Integer) As Integer
Private Sub Form_Load()
Dim asdf As Integer
asdf = 5
asdf = asdfness(asdf)
MsgBox asdf
End Sub

extern "C" {
int __declspec(dllexport) asdfness(int asdf) {
int lolz = 0;
lolz = asdf + 3000;
return lolz;
}
}

<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

l2k-Shadow

aha your call is the problem gotta ByVal asdf
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

brew

#8
Crashes now. Really bad, too. It freezes for like 6-7 seconds before i get the error message
Perhaps i should change the arguments in the dll?
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

l2k-Shadow

Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

brew

yes. in my call.
doesn't matter now, i was able to get char * arguments working properly (i'm suprised) :-D
muwhahahahaha
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

UserLoser

has to be __stdcall for vb to work w/ it.

brew

#12
oh? it works without _stdcall when compiled though. might be something with the pcode when you test in the ide.

**edit
using _stdcall makes it not work at all... now it says entry point not found. :-(
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

UserLoser

Don't know how you have it working, must be a coincedence or something because the only calling convention that VB understands is __stdcall.

l2k-Shadow

He is doing this:

Declare Function "test" lib "testdll" () As Long


in C++:

extern "C"
{
__declspec(dllexport) int test()
{
return 5;
}
}

exports function "test"

however,

__declspec(dllexport) int __stdcall test()
{
return 5;
}

exports function "_test@16"

hence trying to call test, when the name compiled is _test@16 would return entry point not found.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.