Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: C++Builder Berlin - How can I use DLL or SO Files?



Permlink Replies: 7 - Last Post: Jan 10, 2017 10:00 AM Last Post By: Remy Lebeau (Te...
İbrahim Ak

Posts: 23
Registered: 5/23/16
C++Builder Berlin - How can I use DLL or SO Files?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2017 5:01 AM
Hi; I'm using C++Builder Berlin. I want to use jvm.dll file in <JavaPath>/jre/bin/server directory. I added Project -> Options -> C++ (Shared Options) : Include Path = <JavaPath>jdk/include;<JavaPath>jdk/include/win32 and Library path = <JavaPath>/jre/bin/server. But when I ran jni code, I get error: "[ilink32 Error] Error: Unresolved external 'JNI_CreateJavaVM' referenced from C:\USERS\USERNAME\DOCUMENTS\EMBARCADERO\STUDIO\PROJECTS\WIN32\DEBUG\FILE1.OBJ". How can I use a dll or so file in C++Builder Berlin? Thanks.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: C++Builder Berlin - How can I use DLL or SO Files?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2017 9:35 AM   in response to: İbrahim Ak in response to: İbrahim Ak
İbrahim wrote:

But when I ran jni code, I get error:
"*[ilink32 Error] Error: Unresolved external 'JNI_CreateJavaVM'
referenced from
C:\USERS\USERNAME\DOCUMENTS\EMBARCADERO\STUDIO\PROJECTS\WIN32\DEBUG\FI
LE1.OBJ*".

Use C++Builder's command-line IMPLIB utility to create an import .lib for
jvm.dll:

http://docwiki.embarcadero.com/RADStudio/en/Implib

And then add that .lib file to your project.

--
Remy Lebeau (TeamB)
İbrahim Ak

Posts: 23
Registered: 5/23/16
Re: C++Builder Berlin - How can I use DLL or SO Files?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2017 2:59 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Use C++Builder's command-line IMPLIB utility to create an import .lib for
jvm.dll:

http://docwiki.embarcadero.com/RADStudio/en/Implib

And then add that .lib file to your project.

--
Remy Lebeau (TeamB)

Thanks, my project for Clang (Win64). So, I have to use mkexp.exe. I tried this command: mkexp.exe jvm.lib "C:\Program Files\Java\jre1.8.0_60\bin\server\jvm.dll"
I didn't get any error, but I didn't find jvm.lib file, where is it?
Antonio Estevez

Posts: 665
Registered: 4/12/00
Re: C++Builder Berlin - How can I use DLL or SO Files? [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2017 3:24 AM   in response to: İbrahim Ak in response to: İbrahim Ak
El 10/01/2017 a las 12:00, İbrahim Ak escribió:
Use C++Builder's command-line IMPLIB utility to create an import .lib for
jvm.dll:

http://docwiki.embarcadero.com/RADStudio/en/Implib

And then add that .lib file to your project.

--
Remy Lebeau (TeamB)

Thanks, my project for Clang (Win64). So, I have to use mkexp.exe. I tried this command: mkexp.exe jvm.lib "C:\Program Files\Java\jre1.8.0_60\bin\server\jvm.dll"
I didn't get any error, but I didn't find jvm.lib file, where is it?

Probably in your user home folder: C:\Users\YourUserName

İbrahim Ak

Posts: 23
Registered: 5/23/16
Re: C++Builder Berlin - How can I use DLL or SO Files? [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2017 5:57 AM   in response to: Antonio Estevez in response to: Antonio Estevez
Probably in your user home folder: C:\Users\YourUserName

I changed command: mkexp.exe jvm.a "C:\Program Files\Java\jre1.8.0_60\bin\server\jvm.dll"
But the file not found on C:\Users\Username
Antonio Estevez

Posts: 665
Registered: 4/12/00
Re: C++Builder Berlin - How can I use DLL or SO Files? [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2017 8:35 AM   in response to: İbrahim Ak in response to: İbrahim Ak
El 10/01/2017 a las 14:57, İbrahim Ak escribió:
Probably in your user home folder: C:\Users\YourUserName

I changed command: mkexp.exe jvm.a "C:\Program Files\Java\jre1.8.0_60\bin\server\jvm.dll"
But the file not found on C:\Users\Username

The file is stored into the current console directory.

After run the mkexp command, type
dir *.a
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: C++Builder Berlin - How can I use DLL or SO Files? [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2017 10:00 AM   in response to: Antonio Estevez in response to: Antonio Estevez
Antonio wrote:

The file is stored into the current console directory.

Unless you specify a full path for the output file, eg:

mkexp.exe "C:\path to\jvm.a" "C:\Program Files\Java\jre1.8.0_60\bin\server\jvm.dll"


--
Remy Lebeau (TeamB)
Antonio Estevez

Posts: 665
Registered: 4/12/00
Re: C++Builder Berlin - How can I use DLL or SO Files? [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2017 3:29 AM   in response to: İbrahim Ak in response to: İbrahim Ak
El 10/01/2017 a las 12:00, İbrahim Ak escribió:
I tried this command: mkexp.exe jvm.lib "C:\Program Files\Java\jre1.8.0_60\bin\server\jvm.dll"

The library file extension for the Win64 platform must be .a
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02