That being said

$ nm `which node` | grep fopen
                 U fopen64@@GLIBC_2.2.5
                 U fopen@@GLIBC_2.2.5

seems to indicate that fopen is indeed dynamically linked.



On Thursday, 12 February 2015 07:05:01 UTC+1, cinyoung hur wrote:
>
> Hello,
>
> I'm testing addon with LD_PRELOAD hooking.
>
> In the test, I made hooking object for fopen call.
> When I test with this example, fopen hooking worked.
>
> #include <stdio.h>
>
> int main()
> {}
>     // ld_preload test
>     FILE* fd = NULL;
>     printf("Calling the fopen() function. \n");
>     fd = fopen("test.txt", "r");
>     if(!fd) {
>       printf("ok\n");
>
>     }
>     printf("fopen() succeeded\n");
> }
>
> But, if I apply this within node addons, hooking didn't work.
>
> NAN_METHOD(MyObject::New) {
>   NanScope();
>
>   if (args.IsConstructCall()) {
>     // Invoked as constructor: `new MyObject(...)`
>     MyObject* obj = new MyObject();
>     obj->Wrap(args.This());
>
>     // ld_preload test
>     FILE* fd = NULL;
>     printf("Calling the fopen() function. \n");
>     fd = fopen("test.txt", "r");
>     if(!fd) {
>       printf("null\n");
>
>     }
>     printf("fopen() succeeded\n");
>     
>     NanReturnValue(args.This());
>   } 
> }
>
>
> Node addon documents say that Node statically compiles all its 
> dependencies into the executable.
> http://nodejs.org/docs/latest/api/addons.html
>
> Is that why LD_PRELOAD is not working?
> Please guide me to solve this problem.
>
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/7e2ffa1f-7fe5-475b-bbf3-9dbd9efd0e3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to