loadlibrary

How do I load a native library (.so) from another native library (.so)?

夙愿已清 提交于 2019-12-11 15:49:06
问题 So, my code right now is like it loads library (say liba.so) from Java-layer and internally liba.so loads libb.so. So, if I have to pack all the libraries inside an APK and install it on a device with no root access then what is the procedure to structure my project in which one load call from Java-layer will load both the libraries, first liba.so (direct call) and then libb.so (second call, nested call, call from liba.so)? 回答1: If both liba.so and libb.so are packed into your APK, then the

WOW64 Redirection and LoadLibrary

为君一笑 提交于 2019-12-11 14:45:03
问题 I'm trying to build a 32-bit program that can run correctly on 64-bit Windows; that is, if it needs to open a text file for the user, the file needs to not be redirected from C:\Program Files to C:\Program Files (x86) . However, if I just call Wow64DisableWow64FsRedirection , then my program fails to load at all because some system libraries call LoadLibrary when portions of the GUI are loading, which tries to load a 64-bit version of a system DLL into my program. How do I solve this problem?

Loading/calling ntdll from DllMain

笑着哭i 提交于 2019-12-11 14:15:28
问题 One should not use functions other than those in kernel32.dll from DllMain : From MS documentation: Because Kernel32.dll is guaranteed to be loaded in the process address space when the entry-point function is called, calling functions in Kernel32.dll does not result in the DLL being used before its initialization code has been executed. Therefore, the entry-point function can call functions in Kernel32.dll that do not load other DLLs. For example, DllMain can create synchronization objects

Calling WinSock functions using LoadLibrary and GetProcAddress

主宰稳场 提交于 2019-12-11 07:09:25
问题 Basically I have a header file like this: #if WIN32 typedef DWORD (WSAAPI *SocketStartup) (WORD wVersionRequested, LPWSADATA lpWSAData); typedef SOCKET (WINAPI *MakeSocket)(IN int af, IN int type, IN int protocol, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, IN GROUP g, IN DWORD dwFlags ); typedef DWORD (WINAPI *SocketSendFunc) (IN SOCKET s,__in_bcount(len) const char FAR * buf, IN int len,IN int flags); typedef DWORD (WINAPI *GetLastSocketErrorFunc)(); typedef DWORD (WINAPI *ShutdownSocketFunc)

C# LoadLibrary ERROR_NO_TOKEN

别来无恙 提交于 2019-12-11 06:16:27
问题 I'm loading a MFC dll with dependencies (let's say I'm loading D.dll, which depends on C.dll, B.dll and A.dll) in C#. Here's my code: [DllImport( "kernel32.dll", CharSet = CharSet.Auto, SetLastError = true )] static extern IntPtr LoadLibrary( string lpFileName ); private void btn_Click( object sender, EventArgs e ) { int nUltErr; string strDLL; StringBuilder strPDF; StringBuilder strXML; strDLL = "C:\\DEVELOP\\Libs\\Interfaccia\\Interfaccia_C_2005\\DLL\\Interfaccia_C_2005.dll"; strFile1 = new

Building a jni lib for tux rider android application

匆匆过客 提交于 2019-12-11 05:58:10
问题 I've downloaded drodin's android app "Tux rider" source code, in order to build it my self. https://github.com/drodin/TuxRider in the application, there's a call for a library called "tuxrider" System.loadLibrary("tuxrider"); but there's no such library, and I'm not managing to figure out how to build one from all the files there. 回答1: There seem to be build scripts for that library in TuxRider/jni/tuxrider. You'll probably need to download Android NDK (http://developer.android.com/sdk/ndk

Java loadLibrary() cannot locate library after switching from 64 bit jdk to 32 bit

痞子三分冷 提交于 2019-12-11 02:53:35
问题 I am attempting to load a native library which accordingly loads an original dll. However on another computer running XP 32bit, it works fine. When executed on a win7 64 bit system it would fail to load. On the xp machine, the dll files could be in same directory as class files, however in order to not get a unsatisfied link error, i had to copy the files into the system32 folder. Then it gave an error stating that a 32bit dll cannot be loaded on a 64 bit process. I downloaded the 32 bit jdk

Is it necessary to call system.loadLibrary explicitly for accessing the native methods in a NativeActivity sub class?

做~自己de王妃 提交于 2019-12-11 02:43:35
问题 I have an Android app with an activity derived from NativeActivity like this: public class MyNativeActivity extends android.app.NativeActivity { public native void TellNativeSide(int info); static { System.loadLibrary("MyNatAct"); // <--- is this necessary? } public int OtherMethods(...) ... } On the C/C++ side, I have extern "C" void Java_mycom_nativity_MyNativeActivity_TellNativeSide(JNIEnv *env, jobjectactivityobj, jint info) { ... do something } // java native TellNativeSide() method //

Detect the unloading of DLLs

微笑、不失礼 提交于 2019-12-11 00:25:30
问题 I have a special requirement, and I believe there is no other way, that is: Detect the unloading of DLLs. I googled it and found out a four-years old SO about this. I have chosen the same solution: Hook FreeLibrary . When code goes into MyFreeLibrary , I will hook the entry point of the specified module in the same way (inline-hook). And in MyEntryPoint , I will call the original entry point first, then check the reason argument - if the value equals to DLL_PROCESS_DETACH , it means that the

Using a dll file in matlab code

☆樱花仙子☆ 提交于 2019-12-10 21:10:06
问题 I need to use a function in Matlab that is defined by a dll file. I got an example that guy converted a dll to mexw32 file but i have known how I do this. I tried use loadlibrary but it didn't create any file. How I can do this? 回答1: loadlibrary is MATLAB's implementation of FFI services, a mechanism of calling functions in external shared libraries. It involves converting between C-types and their equivalent MATLAB data types to pass data around. MEX-files are also a kind of dynamically