Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / DLL_Tool Return Statement

Author
Message
xyzz1233
17
Years of Service
User Offline
Joined: 18th Nov 2007
Location:
Posted: 1st Jun 2008 21:12 Edited at: 1st Jun 2008 21:59
I'm using DLLTool to convert a managed C# DLL to unmanaged code. I am running into some problems regarding return statements, though.

For example, this code works:



However, this code doesn't work:



Functions that return stuff always give me this error:

Microsoft (R) .NET Framework IL Assembler. Version 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
Assembling 'COCUME~1ZANEKA~1LOCALS~1Temp_dll.il' to DLL --> 'Cocuments and SettingsZane KaminskiMy DocumentsMySQL DLLDLLbinReleaseUnmanagedDLL.dll'
Source file is ANSI


***** FAILURE *****

What should I do? Thanks in advance!
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 2nd Jun 2008 05:02
What does your string table look like?

G T R
19
Years of Service
User Offline
Joined: 26th Apr 2005
Location: Dubai, UAE
Posted: 2nd Jun 2008 14:19
I am having a similar problem
In some weird cases the dll tool fails to build
For Example this function in C# will cause the dll tool
to show the error:

string table:
TICKME[%L0%tickme%

and somehow if I comment these lines it works!!


ILcode:



If someone could help me solve this problem I'll be grateful.
xyzz1233
17
Years of Service
User Offline
Joined: 18th Nov 2007
Location:
Posted: 3rd Jun 2008 03:43 Edited at: 3rd Jun 2008 03:44
Here's the actual code I'm testing: Just thought it may be useful...



And here's the string table:

TESTCONNECTION[%S0%TestConnection%
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 3rd Jun 2008 06:01
You're returning bool and your string table shows it's returning a string. For booleans you'd do something like this:

TESTCONNECTION[%D0%TestConnection%

Refer to this link for string table documentation.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 3rd Jun 2008 15:42
Drop the zero from the argument list and it'll be fine - the only time you need the zero is when the argument/return list is completely empty.

xyzz1233
17
Years of Service
User Offline
Joined: 18th Nov 2007
Location:
Posted: 4th Jun 2008 01:33
Still doesn't work... I've tried it with both of these string tables with no avail:


TESTCONNECTION[%D0%TestConnection%

and

TESTCONNECTION[%D%TestConnection%
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 5th Jun 2008 21:37
you also need to make the function return DWORD, not bool Bools are only 1 byte long, and when I've tried using a bool typed function, false can read as true, because of the other bytes being non-zero.

the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 7th Jun 2008 00:36
dll_tool works by disassembling the dll to MSIL then modifing the disassembly before assembling it back to a dll.

Ok when it works. When it doesn't work you are a bit stuck. Unless you have a lot of background knowledge and can go digging through the disassembly to see what went wrong.

Unfortunately a lot of the time I think it's easier just to use something else that will produce dbpro compatible dlls directly. Or look at styx but I haven't used it myself.

By way of demonstration, he emitted a batlike squeak that was indeed bothersome.
xyzz1233
17
Years of Service
User Offline
Joined: 18th Nov 2007
Location:
Posted: 7th Jun 2008 06:52
Well, I got it working, so it doesn't matter any more...

Login to post a reply

Server time is: 2024-11-23 05:52:21
Your offset time is: 2024-11-23 05:52:21