Jump to content

View more

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

DLLimport kernal32 in C#

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 LiquidWotter   Members   

100
Like
0Likes
Like

Posted 01 June 2011 - 03:22 PM

When I try to use:


[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("kernal32")]
private static extern bool QueryPerformanceFrequency(ref
            long PerformanceFrequency);

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("kernal32")]
private static extern bool QueryPerformaceCounter(ref
            long PerformanceCount);


It throws me a System.dllNotFoundException in my game loop.

I tired to changing it to "kernal32.dll", but that didn't work. I tired a quick search to see if it had anything to do with the fact i'm running 64 bit win7, but I couldn't find anything on that. I have been able to get DLLimport to work in the past with other dll files, I am unsure why it isn't working with this dll.

Any help I can get is greatly appreciated.
LiquidWotter

#2 doesnotcompute   Members   

262
Like
1Likes
Like

Posted 01 June 2011 - 04:40 PM

When I try to use:


[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("kernal32")]
private static extern bool QueryPerformanceFrequency(ref
            long PerformanceFrequency);

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("kernal32")]
private static extern bool QueryPerformaceCounter(ref
            long PerformanceCount);


It throws me a System.dllNotFoundException in my game loop.

I tired to changing it to "kernal32.dll", but that didn't work. I tired a quick search to see if it had anything to do with the fact i'm running 64 bit win7, but I couldn't find anything on that. I have been able to get DLLimport to work in the past with other dll files, I am unsure why it isn't working with this dll.

Any help I can get is greatly appreciated.
LiquidWotter



Check your spelling (it's k-e-r-n-e-l not kernal).

EDIT:

Also, you can use the Stopwatch class in System.Diagnostics instead of pinvoking QueryPerformaceCounter.

#3 LiquidWotter   Members   

100
Like
0Likes
Like

Posted 01 June 2011 - 05:41 PM

Wow I'm such an idiot. That fixed it thanks!

Also thanks for the class suggestion, I knew there had to be an easier way, but I am currently going through a book so I'm doing it the author's way first hehe.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.