Announcement

Collapse
No announcement yet.

DLLs and Native functions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    DLLs and Native functions

    Been a while since I posted here. I'm trying to make a DLL that will have functions to read and write to the games .ini files, as well as detecting things like the max resolution of the monitor, etc. In UnrealScript is it possible to use the Native function to call on these DLLs?
    Code:
    native
    Says "this class uses behind-the-scenes C++ support". Unreal expects native classes to contain a C++ implementation in the DLL corresponding to the class's package. For example, if your package is named "Robots", Unreal looks in the "Robots.dll" for the C++ implementation of the native class, which is generated by the C++ IMPLEMENT_CLASS macro.
    This was used in UT3 to read settings and information and parse that information in C++ rather than in UnrealScript and I'd like to try to accomplish the same thing.

    Here is an excerpt of code from the UT3 source that calls the native function to get settings data:
    (Found in: Engine/Classes/Settings.uc)

    Code:
    static native function string GetSettingsDataString(out SettingsData Data);
    
    /**
     * Static function for copying data out of the SettingsData union
     *
     * @param Data the data structure to copy the data from
     */
    static native function float GetSettingsDataFloat(out SettingsData Data);
    
    /**
     * Static function for copying data out of the SettingsData union
     *
     * @param Data the data structure to copy the data from
     */
    static native function int GetSettingsDataInt(out SettingsData Data);
    
    /**
     * Static function for copying data out the SettingsData union
     *
     * @param Data the data structure to copy the data from
     * @param OutBlob the buffer to copy the data into
     */
    static native function GetSettingsDataBlob(out SettingsData Data,out array<byte> OutBlob);
    
    /**
     * Static function for getting members of the SettingsData union
     *
     * @param Data the data structure to get the fields of
     * @param OutInt1 first half of the data to get
     * @param OutInt2 second half of the data to get
     */
    static native function GetSettingsDataDateTime(out SettingsData Data,out int OutInt1,out int OutInt2);
    /**
     * Searches the localized string setting array for the matching id and sets the value
     *
     * @param StringSettingId the string setting to set the value for
     * @param ValueIndex the value of the string setting
     * @param bShouldAutoAdd whether to add the context if it is missing
     */
    I'd like to try to accomplish the same kind of thing on my own. And basically what I'm wondering is if it's even possible to accomplish this per se? But writing all of the code on my own and not taking from the UT3 source?

    So I'd be able to do something like:

    Code:
    native function GetResolutionData(out int ResX, out int ResY);
    And have a corresponding function in a DLL to feed it the data?

    #2
    You can use DLLBind. You can create a DLL with C++/.NET.

    Full native support is only available with the full engine source code.

    Comment


      #3
      Link was dead, but I've heard of DLLBind I'll give that a try and come back if I have trouble. Thank you very much.

      Comment


        #4
        Lol. Pasted the wrong text into the Link creation dialog.

        Comment

        Working...
        X