Problems creating a DLL

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Hi all,

I'm still working on my ISAPI project, and I just can't get my DLL to work.
The DLL has to provide al least 2 functions: GetExtensionVersion and HttpExtensionProc. As I try to run my DLL, the Server reports the following:

ERROR: Failure loading DLL function: GetExtensionVersion

So the Server can't find the procedure in my DLL, but it's there.
I found a working DLL example on the Net, and compared it to mine.

Here's my DLL: (the part were the the procedure names are.)

Code: Select all

*********************************************
D`..P`..purebasi
c.dll...........
....X`..l`...`..
........_DLLEntr
[url]mailto:yPoint@12..._Get[/url]
ExtensionVersion
...._HttpExtensi
onProc..........
*********************************************
And here's the other one:

Code: Select all

*********************************************
....upload.dll.@
__lockDebuggerDa
ta$qv.@__unlockD
ebuggerData$qv._
_DebuggerHookDat
a.DllMain.HttpEx
tensionProc.GetE
xtensionVersion.
*********************************************
As you can see, there is no '_' in front of the name, and there are not so much
NULL charakters between the procedure names. There's also a DllMain instead of _DLLEntryPoint@12 .

So Purebasic DLLs are not really standart, are they?

Can someone please help me get this to work? Maybe there's a way by editing the
file with a HEX-editor?

Thanks,

Timo


--

A debugged program is one for which you have not yet found the conditions that make it fail.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

No ideas??

Does anybody know, where i can get more information on DLLs?
Maybe some specification of the File format itself?

Thanks,

Timo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

Purebasic produce DLL's with Functions always beginning with the underscore-character.This is a limit of nasm(and or the linker).Fred knows the problem and
is hopefully fix them (i think in februar).But that is not a limitation.
Purebasic-made-DLL's works fine for me.
So you have to call the function in the DLL like:

_GetExtensionVersion

Instead of
GetExtensionVersion

And for the Fileformat, Search the net for 'PE' .This is the Portable Header format for Exe,DLL's and a lot of other filetypes(VXD,SYS ...).the DLL-Names are in the section 'EXPORT'.with some pe-tools you can change the name, but if you not familar with them , leave them as they are.


Its a long way to the top if you wanna .....CodeGuru

Edited by - Rings on 27 July 2002 16:03:44
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Thanks Rings, I'll have a look...

The problem is that i cant just call like this:
_GetExtensionVersion becourse it's the WebServer that calls it, not me.
Is there no way of removing the underscore?

Anyway, thanks...

Timo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by DemonHell.
The problem is that i cant just call like this:
_GetExtensionVersion becourse it's the WebServer that calls it, not me.
Is there no way of removing the underscore?

Get a hex editor and do a "search and replace" on the function names.
Another tip someone came up with is to ommit the first letter of the function names in your source code to make renaming easier.
eg.
In PB , call your function etExtensionVersion,
PB will compile it to _etExtensionVersion, then you can rename it in the hex editor.

Something else I haven`t checked out is if DLL files have checksums that need to be altered too. I`ve done the above before and not had any problems though.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

I've allready tried that, and it didn't work
This PE stuff is too confusing for me, so this didn't help either.

Any other ideas??

Timo
Post Reply