LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-30-2014, 08:24 AM   #16
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124

static variables, functions, ... only affect linking, meaning as symbols they are restricted in use to the file they are declared in, but at the point of use it's a pointer/memory location and as such can be passed around and used as much as you want, allowing you to call other functions with that variable. As an example take a look at static function jump tables or plugin setups. You use static declarations to prevent symbol clashes and restrict access but you pass out a pointer to that table during initialization so your functions/plugin can be used.
 
Old 04-30-2014, 03:05 PM   #17
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Alright, so can you post what code works and what code doesn't. Maybe there's something that has changed that we are missing.
 
Old 05-02-2014, 03:10 AM   #18
abirt
LQ Newbie
 
Registered: Apr 2014
Posts: 15

Original Poster
Rep: Reputation: Disabled
Hi,

@Estabroo: thanks for your explanation.
@Metaschisma: the last code that I posted was returning a wrong output (hash value) but when I replaced, in the same code, the declaration of "static uint8_t m[5000]" by "m = vmalloc(5000 * sizeof(uint8_t))" (with a corresponding vfree(m)) inside the "init_module()", I got the good result (hash value).
 
Old 05-02-2014, 11:23 AM   #19
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Can you try using a for loop to initialize instead of memset ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help on linux kernel crypto API HSN Linux - Kernel 1 12-31-2010 02:29 PM
arc4 crypto api - can't find reccursive Linux - Kernel 1 07-24-2009 12:38 PM
Install Crypto API on Linux Kernel saurabhchokshi Programming 4 04-30-2009 06:34 AM
True stream cipher in crypto API module? ta0kira Linux - Security 0 07-23-2005 02:10 AM
linux crypto api saajii Programming 3 08-31-2004 09:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration