0

> Could you be more especific when you say "setup the same thing in Visual studio"?

Simply set up a new DLL C project in Visual studio. Create new blank project. Right click project -> General -> Configuration Type set to Dynamic Library DLL

Right click Header folder -> add item -> add your header

Right click Source folder -> add item -> add your .c file

Right click project -> c/c++ -> Additional include directories -> add paths to java\include and java\include\win32

Right click project -> rebuild -> the output window will show you the location of the newly created dll

For more detailed instructions, you should probably speak with the C++ guys from your team since they should definitely be able to help you out with this one.

Ah ok :) I imagined you ment this but I just wanted to make sure.

This might be a dumb question but would this make a normal C/C++ DLL or a C/C++ .NET DLL?

And the C++ team pretty much have no clue how to make a .DLL They commented that once we get JNI working with some basic examples showing that it works, they will read up on DLLs and start on that part.

Tommorow Im going to try this out as well and Ill post back with the results (in about 7 and a half hours)

Thanks alot for all this troubleshooting :) Like I said, we are very thankful :)

1

> This might be a dumb question but would this make a normal C/C++ DLL or a C/C++ .NET DLL?

You would need a normal C/C++ DLL.

> And the C++ team pretty much have no clue how to make a .DLL

That's news. I hope you are not stuck with fresh-out-of-college-self-proclaimed C++ programmers...

Edited by ~s.o.s~: n/a

0

> This might be a dumb question but would this make a normal C/C++ DLL or a C/C++ .NET DLL?

You would need a normal C/C++ DLL.

> And the C++ team pretty much have no clue how to make a .DLL

That's news. I hope you are not stuck with fresh-out-of-college-self-proclaimed C++ programmers...

Thats why I asked if VS would output a standard DLL using standard C++ libraries or would it output a DLL using .NET Framework.

And the C++ programmers have pretty much made the GUI, math calculations (alot more complex than 2+2), and made some binary files so a machine they have can read it and cut the metal sheet so I think they have a idea. They have just never needed to make a .DLL

0

Tried doing it in VS and it gives me this error:

Fatal Error C1902: The program's data base administrator isnt the same; Please check the instalation.

What does SQL server have anything to do with this? It installs the express edition but why?

0

> Fatal Error C1902: The program's data base administrator isnt the same; Please check the instalation.

What does a web search for the error code say? There are a lot of posts out there with th same question and solution; one of them might work out for you.

> What does SQL server have anything to do with this? It installs the express edition but why?

Not sure; during the installation, I unchecked everything.

0

> Fatal Error C1902: The program's data base administrator isnt the same; Please check the instalation.

What does a web search for the error code say? There are a lot of posts out there with th same question and solution; one of them might work out for you.

> What does SQL server have anything to do with this? It installs the express edition but why?

Not sure; during the installation, I unchecked everything.

I actually had a tab open searching for the error. Just wanted to keep a log of everything on this thread.

It was a old DLL so I uninstalled and reinstalled VS

On the reinstallation I only checked VS so Im going to try again....

0

Im sorry to have not replied. I FINALLY was able to reproduce the .DLL and execute the java program using the C .DLL. I was even able to call a java program passing arguments (a simple add program) and it was able to give me a output.

The only problem I had is that I passed the HelloWorld.class and the HelloWorld.dll to another PC and he put it in the a folder both files. And it was not able to run. It said it couldnt find the the library path. On that PC, both VS and JDK was installed.

Some progress was done but obviously it needs to be ran on another PC to be able to work 100%.

I used the VS method you stated. That produced the .DLL (that and using the sun tutorial)

So thanks alot but that would be the only thing: Why doesnt it work on another PC?

0

> Why doesnt it work on another PC?

More details as always. When you say "couldn't find library path", was is some linker exception? Which DLL/library did it say was missing? The one you created or a completely different one? Do both the computers have the same OS? You might also want to look at the other PC for old DLL's and do some cleanup if required.

BTW, it is not a requirement for the other PC to have Visual Studio installed on target machines, just the proper runtime would do.

0

> Why doesnt it work on another PC?

More details as always. When you say "couldn't find library path", was is some linker exception? Which DLL/library did it say was missing? The one you created or a completely different one? Do both the computers have the same OS? You might also want to look at the other PC for old DLL's and do some cleanup if required.

BTW, it is not a requirement for the other PC to have Visual Studio installed on target machines, just the proper runtime would do.

I believe it came up with a LD_LIBRARY_PATH type of error. It didnt really state anything else but just in case my partner on this project will check it out now. Both are running XP and we have stated that we are going to format both PCs as there is "DLL hell" all over the place, with copies of DLLs in different folders.

Again, I cant thank you enough for your time. You have made it easier for both of us.

0

The error is:

C:\>java HelloWorld
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\HelloWorld.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at HelloWorld.<clinit>(HelloWorld.java:10)
Could not find the main class: HelloWorld. Program will exit.


Both the .class and the .dll that works on my PC were there.

Edited by riahc3: n/a

1

> C:\HelloWorld.dll: Can't find dependent libraries

When you load a DLL, the dependent DLL's get loaded as well and if they are not found, this error is raised. The dependent DLL's should be in the PATH env variable or in -Djava.library.path system property. Assuming you are not using -Djava.library.path, do both of you have the same PATH env settings? Do you see any difference in there?

Also, do you have a conflicting version of DLL's in the directories on your PATH (i.e. you have a.dll ver 1 and your partner has got a.dll of ver 2 in system32 folder).

0

> C:\HelloWorld.dll: Can't find dependent libraries

When you load a DLL, the dependent DLL's get loaded as well and if they are not found, this error is raised. The dependent DLL's should be in the PATH env variable or in -Djava.library.path system property. Assuming you are not using -Djava.library.path, do both of you have the same PATH env settings? Do you see any difference in there?

Also, do you have a conflicting version of DLL's in the directories on your PATH (i.e. you have a.dll ver 1 and your partner has got a.dll of ver 2 in system32 folder).

We have modified our PATH to be the same and it works now on his PC. Thank you very much. You have helped us out alot and without a doubt without you we could not have resolved this.

Thanks alot.

0

Good luck with your project. :-)

Thank you it tooks us 5 pages of daniweb, 4 days, your help, and headaches to get hello world working. I have no idea how were are going to get his program working with .cpp and .h files that call each other and functions and etc etc....

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.