473,395 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

C# DllImport Problem

6
Hello -

I have some code I'm invoking with DllImport and the functions work flawlessly while executing through the debugger, but not in the stand-alone executable. When running the exe, the program hangs as soon as it gets to executing the dll. After awhile it will say "(Not Reponding)".

The code also works on console applications, both in the debugger and the built executable.

So, what's the difference between the console app and the windows app (and the debugger) that could be causing only the windows app to hang while running my dll, when it works fine every other time?

Thanks in advance for any help!
Mar 3 '08 #1
4 2212
Plater
7,872 Expert 4TB
Are you making references to any pointers or GUI components in these dll functions?
Mar 3 '08 #2
tk121
6
Are you making references to any pointers or GUI components in these dll functions?
No - In fact some of the external functions that I'm testing with don't have any inputs at all.
Mar 3 '08 #3
Plater
7,872 Expert 4TB
Are you using the results in GUI objects anywhere?
In your windows form application, start adding like logging statements after like every line in your code and have it log to a file (or something)
Then run your code and see how far it gets.

If you can, maybe even do the same in the DLL you are using.
Mar 3 '08 #4
tk121
6
Are you using the results in GUI objects anywhere?
In your windows form application, start adding like logging statements after like every line in your code and have it log to a file (or something)
Then run your code and see how far it gets.

If you can, maybe even do the same in the DLL you are using.
I added logging statements and it gets right up to the point where it calls the external function, and then hangs right on that call. The first statement in the dll function (a simple printf statement) never executes.

If I didn't know better, I'd think it was having a problem finding the dll, or the insertion point for the function, but everything works like a charm in the debugger (and on a console app), so I don't think it's that.

When running through the debugger it executes the embedded printf statement as well as logging statements after the dll function exits.
Mar 4 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: caviar | last post by:
Hi, i'm having a problem with a native w32 dll. Everything is working fine except for one parameter which is defined as: --------------------------------------header file--- // short PASFIX...
15
by: Jim | last post by:
I am extremely frustrated. I am building c# application for a call center and am using a third party API to access some hardware. When develop and test my class using the windows console the...
2
by: Kurt Ng | last post by:
Hi, y'all. Can anyone help me on this problem? I'm working with a third-party C dll, and I'm having trouble importing into C# the dll's methods that return one of the dll's defined types,...
1
by: Whidbey Wave | last post by:
Hi , Of course sometimes, some of us have these weird DLLImport issues. I am using Net-snmp library from http://www.net-snmp.org. While creating a prototype as console application it worked fine,...
2
by: Brian Anderson | last post by:
Hello, is it possible to use DllImport to call a DLL in ASP.NET ? Or is it necessarry that my DLL has to be copied into \System32 ? My DLL is a native C++ 7.1 DLL (not managed, no COM, no...
1
by: Seth Gecko | last post by:
Hi I am developing a complex VB.Net Windows application for an engineering firm (don't ask me why they prefer VB.Net...). All the engineering calculations are done in FORTRAN which is compiled...
1
by: kardon33 | last post by:
Let me explain my problem, Im currently trying to use a Perl module that was built for a Windows OS that uses a .dll and .lib file. I have obtained the c header files that the modules were built...
1
by: JohnCox | last post by:
I have a simple Win32 DLL I wrote named "SimpleLib" that exports two functions. It is written in C++ and compiled with __stdcall (/Gz) and with the preprocessor definition _MBCS (not Unicode). ...
1
by: elke | last post by:
Hi, I want to use an unmanaged dll in C# .net and I'm having some troubles witch a function that should return an array. I'm new at this, so I don't know what I'm doing wrong. Here is some...
1
by: mrssuper | last post by:
Hey All, How do I declare a following types: char** unsigned char** in C# DllImport function?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.