Hello everyone,

I'm quite new to c# and .Net, and i was wondering if you can give me some guidance on a specific problem that i have

I'm currently trying to use Jxta.NET: a .net wrapper for JXTA-C, which is the C implementation of the JXTA protocol.

So, i went on their website, downloaded the sources (since no binaries are provided), converted the included VS project from VS 6 to VS 2008, and managed to compile the whole library.

This resulted in 2 dll files:
- JxtaNET.dll : The .net wrapper, which use jxta.dll.
- jxta.dll : The JXTA-C shared library, written in C.

Then i created a new C# project, added a reference to the "JxtaNet.dll", and compiled some basic JXTA application. Everything went fine, until a tried to run it.

As soon as JxtaNet tries to load the underlying jxta.dll with a "DllImport" statement, an exception is raised:

An unhandled exception of type 'System.DllNotFoundException' occurred in JxtaNET.dll.
Additional information: Unable to load DLL 'jxta.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

The problem is, that the specified dll should be perfectly retrievable. My path variable is up to date, and i've also tried to copy the corresponding dll (jxta.dll) in my system32 folder and in the current working directory when launching the app, but nothing works... and i'm out of ideas.

I suspect that the dll i've compiled is somehow buggy, but i've no idea how to check what's gone wrong. Do have you any tips to solve this? Any help would be the most welcome.

Thanks,

M. H.

Recommended Answers

All 6 Replies

Have you tried executing the application outside of the debugger? If that fixes it (I doubt it) then shut the visual studio hosting process off for the project. The hosting process tends to screw up more than it helps.

As for the JxtaNET.dll you can use RedGate's reflector to decompile the assembly and take a peek at how it is attempting to load the DLL. That would be where I would start.

You could also zip up the DLLs in question and upload them here. I can take a look at them.

Hello Scott,

Thank you for replying.

Have you tried executing the application outside of the debugger?

Yes, i already tried to run the app outside the debugger but without luck so far.

As for the JxtaNET.dll you can use RedGate's reflector to decompile the assembly and take a peek at how it is attempting to load the DLL. That would be where I would start.

This is the piece of code used to load the dll, according to the .net reflector:

public class JxtaObject
    {
        #region import of jxta-c functions
        [DllImport("jxta.dll")]
        private static extern void jxta_initialize();

        [DllImport("jxta.dll")]
        private static extern void jxta_terminate();

        [DllImport("jxta.dll")]
        private static extern Int32 _jxta_object_release(IntPtr self, String s, Int32 i);

        [DllImport("jxta.dll")]
        private static extern IntPtr _jxta_object_share(IntPtr self, String file, Int32 line);
        #endregion

	[...]

You could also zip up the DLLs in question and upload them here. I can take a look at them.

That would be great, i'll post them here in a few minutes with a sample app.

Thanks again.

Marc.

So. here are the dlls and an example of code throwing the error...

All feedbacks are welcome...

You're probably missing required dependencies. Download dependency walker and examine jxta.dll. I (obviously) do software development and have about every development library pack I have come across installed on my machine... and i'm still missing dependencies. If the dependencies are missing it can't load the DLL, thus you get the exception message you are seeing.

I have attached a screenshot of the missing deps on my machine.

It dawned on me I wasn't thinking very hard when I posted my last reply. I was assuming it was only referencing standard windows DLLs but as you can see in dependency walker some of the DLLs aren't. The APR* dlls are for the apache runtime.

Let us know if missing dependencies was the problem and if you can get library loaded. Good luck!

Touché :)

It was a very stupid mistake actually, i did linked all those libraries to my project in order to compile jxta-c, but i forgot to make them available to the whole system.

The resulting error message is quite confusing though...

Now i can finally run my dll... but jxta-c segfault a few instruction later, looks like there's still some fun to be had :) I'll try to investigate that.

Thank you very much for your assistance Scott, you save my day!

Best whises
Marc

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.